21 | Thank to pop me out of that button, but now i'm done so you can close this window.
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/sql/sql_server/change_auth.sql:
--------------------------------------------------------------------------------
1 | --
2 | -- This SQL script allows you to generate a new user and password in SQL Server
3 | --
4 |
5 | USE master
6 | go
7 |
8 | -- Change authentication mode to mixed SQL and Windows authentication
9 | EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'LoginMode', REG_DWORD, 2
10 | go
11 |
12 | -- Create a new SQL login user
13 | -- Replace login name 'sqldba' and password with your choice of user name/password
14 | CREATE LOGIN sqldba
15 | WITH PASSWORD = N'new_password',
16 | CHECK_POLICY = OFF,
17 | CHECK_EXPIRATION = OFF;
18 |
19 | -- Change role of new user to sysadmin role
20 | -- Replace user name 'sqldba' with the one created above
21 | EXEC sp_addsrvrolemember
22 | @loginame = N'sqldba',
23 | @rolename = N'sysadmin';
--------------------------------------------------------------------------------
/js/web/footer_waves/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/sql/sql_server/stored_procedure_create.sql:
--------------------------------------------------------------------------------
1 | ---
2 | --- Create a stored procedure with input and output variables
3 | ---
4 |
5 | USE [database_name]
6 | GO
7 | SET ANSI_NULLS ON
8 | GO
9 | SET QUOTED_IDENTIFIER ON
10 | GO
11 |
12 | IF OBJECT_ID('[dbo].[StoredProcedureName]', 'P') IS NOT NULL
13 | DROP PROCEDURE [dbo].[StoredProcedureName];
14 | GO
15 |
16 | CREATE PROCEDURE [dbo].[StoredProcedureName]
17 | @VariableInput INT,
18 | @VariableOutput FLOAT OUTPUT
19 | AS
20 | BEGIN
21 | -- SET NOCOUNT ON added to prevent extra result sets from
22 | -- interfering with SELECT statements.
23 | SET NOCOUNT ON;
24 |
25 | SELECT @VariableOutput = database_name
26 | FROM table_name
27 | WHERE column_name = @VariableInput
28 |
29 | PRINT 'Output:'
30 | PRINT @VariableOutput
31 | SELECT @VariableOutput
32 | END
33 | GO
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/command_line/linux/pdf_reduce_size.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Reduce pdf size
4 | # Installation in Linux:
5 | # $ sudo apt install ghostscript
6 | #
7 | # Installation in Mac:
8 | # brew install ghostscript
9 | #
10 | # Options:
11 | # -dPDFSETTINGS=/screen lower quality, smaller size. (72 dpi)
12 | # -dPDFSETTINGS=/ebook for better quality, but slightly larger pdfs. (150 dpi)
13 | # -dPDFSETTINGS=/prepress output similar to Acrobat Distiller "Prepress Optimized" setting (300 dpi)
14 | # -dPDFSETTINGS=/printer selects output similar to the Acrobat Distiller "Print Optimized" setting (300 dpi)
15 | # -dPDFSETTINGS=/default selects output intended to be useful across a wide variety of uses, possibly at the expense of a larger output file
16 |
17 | ps2pdf input.pdf output.pdf
18 | ps2pdf -dPDFSETTINGS=/ebook input.pdf output.pdf
19 | ps2pdf -dPDFSETTINGS=/printer input.pdf output.pdf
20 |
--------------------------------------------------------------------------------
/cpp/log/timer.hpp:
--------------------------------------------------------------------------------
1 |
2 | #ifndef TIMER_HPP
3 | #define TIMER_HPP
4 |
5 | #include "time.h"
6 |
7 | class Timer
8 | {
9 | public:
10 | void startTimer() { m_start = clock();}
11 | void stopTimer() { m_end = clock();}
12 | double getTimeInSec(){
13 | m_elapsed_time_sec = (double)(m_end-m_start)/CLOCKS_PER_SEC;
14 | std::cout << "Time required for execution: " << m_elapsed_time_sec << " seconds" << std::endl;
15 | return m_elapsed_time_sec;
16 | }
17 | double getTimeInMiliSec(){
18 | m_elapsed_time_sec = (double)(m_end-m_start)/CLOCKS_PER_SEC;
19 | std::cout << "Time required for execution: " << m_elapsed_time_sec*1000 << " miliseconds" << std::endl;
20 | return m_elapsed_time_sec*1000;
21 | }
22 |
23 | private:
24 | clock_t m_start;
25 | clock_t m_end;
26 | double m_elapsed_time_sec;
27 | };
28 |
29 |
30 |
31 |
32 | #endif //TIMER_HPP
33 |
34 |
--------------------------------------------------------------------------------
/cpp/io/read_file.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "read_file.hpp"
3 |
4 |
5 | bool readFile(const std::string filename, std::vector& data, std::string sep_char){
6 | std::ifstream file;
7 | std::string line;
8 | int npos, lpos;
9 | float d;
10 | file.open(filename.c_str(),std::ios::in);
11 | if(!file.is_open()) return false;
12 | while(getline(file,line)){
13 | line += sep_char;
14 | npos=0;
15 | lpos=0;
16 | while ((npos = (int)line.find(sep_char,lpos)) != std::string::npos){
17 | if (npos > lpos){
18 | std::istringstream iss(line.substr(lpos, npos-lpos));
19 | if (iss >> d){
20 | data.push_back(d);
21 | }
22 | }
23 | lpos = npos + 1;
24 | }
25 | }
26 |
27 | return true;
28 | }
29 |
30 | bool readCSVFile(const std::string filename, std::vector& data){
31 | return readFile(filename, data, ",");
32 | }
33 |
--------------------------------------------------------------------------------
/sql/sql_server/manage_table.sql:
--------------------------------------------------------------------------------
1 | -- Cheatsheet: https://github.com/FavioVazquez/ds-cheatsheets/blob/master/SQL/SQL-cheat-sheet.pdf
2 |
3 | -- Drop the table if it exists
4 | IF OBJECT_ID('table_name') IS NOT NULL
5 | DROP TABLE table_name;
6 |
7 | -- Create a table with different variables. Not null variables must be always be filled, the rest
8 | -- may have null values
9 | CREATE TABLE table_name
10 | (
11 | patient_id varchar(50) NOT NULL PRIMARY KEY,
12 | size_row INT NOT NULL,
13 | size_col INT DEFAULT 0,
14 | array varbinary(max)
15 | );
16 |
17 | -- Add a new column to the table
18 | ALTER TABLE t ADD column;
19 |
20 | -- Drop column c from the table
21 | ALTER TABLE t DROP COLUMN c;
22 |
23 | -- Rename a table from t1 to t2
24 | ALTER TABLE t1 RENAME TO t2;
25 |
26 | -- Rename column c1 to c2
27 | ALTER TABLE t1 RENAME c1 TO c2;
28 |
29 | --Remove all data in a table
30 | TRUNCATE TABLE t;
31 |
--------------------------------------------------------------------------------
/minsc/Firefox.md:
--------------------------------------------------------------------------------
1 | # Firefox
2 |
3 | ## Enable GPU
4 |
5 | Firefox doesn't use the GPU of your machine by default.
6 |
7 | To benefit from using the GPU of your computer when using Firefox, go to the browser and type `about:config` then set the following flags:
8 |
9 | ```
10 | gfx.webrenderer.all true
11 | layers.acceleration.force-enabled true
12 | layers.omtp.enabled true
13 | layout.display-list.retain true
14 | ```
15 |
16 | To check that Firefox is actually using the GPU, the first method is to check the GPU utilisation with methods like `nvidia-smi` or similar. Another way is to type in your browser `about:support`. In the section Graphics, you need to see:
17 |
18 | * GPU: Active Yes
19 | * HW_COMPOSITING: available by default, force_enabled by user:Force-enabled by pref
20 | * WEBRENDER: available by default, force_enabled by user:Force-enabled by pref, disabled by env: Not qualified
21 |
--------------------------------------------------------------------------------
/sql/mysql/manage_table.sql:
--------------------------------------------------------------------------------
1 | ---
2 | --- Example of table creation
3 | ---
4 |
5 | USE my_database;
6 |
7 | -- Drop the table if it exists
8 | DROP TABLE IF EXISTS table_name;
9 |
10 | -- Create a table
11 | CREATE TABLE table_name
12 | (
13 | id SMALLINT NOT NULL auto_increment,
14 | recid INT(11) NOT NULL DEFAULT '0',
15 | filename VARCHAR(250) NOT NULL DEFAULT '',
16 | num INT(11) NULL,
17 | float_num FLOAT(8,6) NOT NULL DEFAULT '0',
18 | letter CHAR(1),
19 | input_date DATE,
20 | PRIMARY KEY (id)
21 | );
22 |
23 | -- Show information about the table
24 | DESCRIBE table_name;
25 |
26 | -- Select all table
27 | SELECT * FROM table_name;
28 |
29 | -- Create a table to upload a csv
30 | CREATE TABLE table_csv
31 | (
32 | id SMALLINT NOT NULL auto_increment,
33 | t FLOAT(8,6) NOT NULL DEFAULT '0',
34 | q0 INT(5) NOT NULL DEFAULT '0',
35 | q1 INT(5) NOT NULL DEFAULT '0',
36 | PRIMARY KEY (id)
37 | );
38 |
39 |
--------------------------------------------------------------------------------
/sql/sql_server/set_database_file_location.sql:
--------------------------------------------------------------------------------
1 | --
2 | -- Script to change the default locations to save the database files
3 | --
4 |
5 | USE [master]
6 | GO
7 |
8 | -- Change default location for data files
9 | EXEC xp_instance_regwrite
10 | N'HKEY_LOCAL_MACHINE',
11 | N'Software\Microsoft\MSSQLServer\MSSQLServer',
12 | N'DefaultData',
13 | REG_SZ,
14 | N'E:\mssql_databases'
15 | GO
16 |
17 | -- Change default location for log files
18 | EXEC xp_instance_regwrite
19 | N'HKEY_LOCAL_MACHINE',
20 | N'Software\Microsoft\MSSQLServer\MSSQLServer',
21 | N'DefaultLog',
22 | REG_SZ,
23 | N'E:\mssql_databases\logs'
24 | GO
25 |
26 | -- Change default location for backups
27 | EXEC xp_instance_regwrite
28 | N'HKEY_LOCAL_MACHINE',
29 | N'Software\Microsoft\MSSQLServer\MSSQLServer',
30 | N'BackupDirectory',
31 | REG_SZ,
32 | N'E:\mssql_databases\backup'
33 | GO
--------------------------------------------------------------------------------
/command_line/docker/tensorflow/dockerfile:
--------------------------------------------------------------------------------
1 | FROM tensorflow/tensorflow:latest-gpu
2 |
3 | RUN pip install fire toolz
4 |
5 | COPY ssh_config /root/.ssh/config
6 | RUN apt-get update && apt-get install -y --no-install-recommends \
7 | openssh-client \
8 | openssh-server \
9 | iproute2 \
10 | && apt-get clean \
11 | && rm -rf /var/lib/apt/lists/* \
12 | # configure ssh server and keys
13 | && mkdir /var/run/sshd \
14 | && ssh-keygen -A \
15 | && sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
16 | && sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd \
17 | && ssh-keygen -f /root/.ssh/id_rsa -t rsa -N '' \
18 | && chmod 600 /root/.ssh/config \
19 | && chmod 700 /root/.ssh \
20 | && cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
21 |
22 |
23 | EXPOSE 23
24 | CMD ["/usr/sbin/sshd", "-D", "-p", "23"]
25 |
26 |
--------------------------------------------------------------------------------
/command_line/docker/mxnet/dockerfile:
--------------------------------------------------------------------------------
1 | FROM mxnet/python:gpu
2 |
3 | RUN pip install fire toolz jupyter scipy scikit-learn
4 |
5 | COPY ssh_config /root/.ssh/config
6 | RUN apt-get update && apt-get install -y --no-install-recommends \
7 | openssh-client \
8 | openssh-server \
9 | iproute2 \
10 | && apt-get clean \
11 | && rm -rf /var/lib/apt/lists/* \
12 | # configure ssh server and keys
13 | && mkdir /var/run/sshd \
14 | && ssh-keygen -A \
15 | && sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
16 | && sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd \
17 | && ssh-keygen -f /root/.ssh/id_rsa -t rsa -N '' \
18 | && chmod 600 /root/.ssh/config \
19 | && chmod 700 /root/.ssh \
20 | && cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
21 |
22 |
23 | EXPOSE 23
24 | CMD ["/usr/sbin/sshd", "-D", "-p", "23"]
25 |
26 |
--------------------------------------------------------------------------------
/js/web/move_around/code.js:
--------------------------------------------------------------------------------
1 | // Attribution: https://codepen.io/vajkri/pen/grgQmb
2 |
3 | var lFollowX = 0,
4 | lFollowY = 0,
5 | x = 0,
6 | y = 0,
7 | friction = 1 / 30;
8 |
9 | function moveBackground() {
10 | x += (lFollowX - x) * friction;
11 | y += (lFollowY - y) * friction;
12 |
13 | translate = 'translate(' + x + 'px, ' + y + 'px) scale(1.1)';
14 |
15 | $('.bg').css({
16 | '-webit-transform': translate,
17 | '-moz-transform': translate,
18 | 'transform': translate
19 | });
20 |
21 | window.requestAnimationFrame(moveBackground);
22 | }
23 |
24 | $(window).on('mousemove click', function (e) {
25 |
26 | var lMouseX = Math.max(-100, Math.min(100, $(window).width() / 2 - e.clientX));
27 | var lMouseY = Math.max(-100, Math.min(100, $(window).height() / 2 - e.clientY));
28 | lFollowX = (20 * lMouseX) / 100; // 100 : 12 = lMouxeX : lFollow
29 | lFollowY = (10 * lMouseY) / 100;
30 |
31 | });
32 |
33 | moveBackground();
--------------------------------------------------------------------------------
/command_line/docker/caffe2/dockerfile:
--------------------------------------------------------------------------------
1 | FROM caffe2ai/caffe2:c2v0.8.1.cuda8.cudnn7.ubuntu16.04
2 |
3 | RUN pip install fire toolz jupyter scipy scikit-learn
4 |
5 | COPY ssh_config /root/.ssh/config
6 | RUN apt-get update && apt-get install -y --no-install-recommends \
7 | openssh-client \
8 | openssh-server \
9 | iproute2 \
10 | && apt-get clean \
11 | && rm -rf /var/lib/apt/lists/* \
12 | # configure ssh server and keys
13 | && mkdir /var/run/sshd \
14 | && ssh-keygen -A \
15 | && sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
16 | && sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd \
17 | && ssh-keygen -f /root/.ssh/id_rsa -t rsa -N '' \
18 | && chmod 600 /root/.ssh/config \
19 | && chmod 700 /root/.ssh \
20 | && cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
21 |
22 |
23 | EXPOSE 23
24 | CMD ["/usr/sbin/sshd", "-D", "-p", "23"]
25 |
26 |
--------------------------------------------------------------------------------
/command_line/docker/cntk/dockerfile:
--------------------------------------------------------------------------------
1 | FROM microsoft/cntk:2.1-gpu-python3.5-cuda8.0-cudnn6.0
2 |
3 | RUN ["/bin/bash", "-c", "source /cntk/activate-cntk && pip install fire toolz"]
4 |
5 | COPY ssh_config /root/.ssh/config
6 | RUN apt-get update && apt-get install -y --no-install-recommends \
7 | openssh-client \
8 | openssh-server \
9 | iproute2 \
10 | && apt-get clean \
11 | && rm -rf /var/lib/apt/lists/* \
12 | # configure ssh server and keys
13 | && mkdir /var/run/sshd \
14 | && ssh-keygen -A \
15 | && sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
16 | && sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd \
17 | && ssh-keygen -f /root/.ssh/id_rsa -t rsa -N '' \
18 | && chmod 600 /root/.ssh/config \
19 | && chmod 700 /root/.ssh \
20 | && cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
21 |
22 |
23 | EXPOSE 23
24 | CMD ["/usr/sbin/sshd", "-D", "-p", "23"]
25 |
26 |
--------------------------------------------------------------------------------
/command_line/docker/base/dockerfile:
--------------------------------------------------------------------------------
1 | FROM nvidia/cuda:8.0-cudnn7-devel-ubuntu16.04
2 |
3 | RUN echo "deb http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 /" > /etc/apt/sources.list.d/nvidia-ml.list
4 |
5 | RUN apt-get update && apt-get install -y --no-install-recommends \
6 | build-essential \
7 | ca-certificates \
8 | cmake \
9 | wget \
10 | curl \
11 | git && \
12 | rm -rf /var/lib/apt/lists/*
13 |
14 | ENV PYTHON_VERSION=3.6
15 | RUN curl -o ~/miniconda.sh -O https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
16 | chmod +x ~/miniconda.sh && \
17 | ~/miniconda.sh -b -p /opt/conda && \
18 | rm ~/miniconda.sh && \
19 | /opt/conda/bin/conda create -y --name py$PYTHON_VERSION python=$PYTHON_VERSION numpy pyyaml scipy \
20 | ipython mkl pandas jupyter ipykernel scikit-learn && \
21 | /opt/conda/bin/conda clean -ya
22 | ENV PATH /opt/conda/envs/py$PYTHON_VERSION/bin:$PATH
23 |
24 | WORKDIR /workspace
25 | RUN chmod -R a+w /workspace
26 |
27 |
--------------------------------------------------------------------------------
/js/web/popup_after_delay_sendy/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | /*Background simulating the sciblog page*/
3 | background-color: #dcdbe0;
4 | background-image: url("https://raw.githubusercontent.com/miguelgfierro/sciblog/main/img/blog_view2.png");
5 | background-size: 1200px;
6 | background-position: top;
7 | background-repeat: no-repeat;
8 | color: #100;
9 | }
10 |
11 | #modal-content {
12 | display: none;
13 | justify-content: center;
14 | align-items: center;
15 | height: 100vh;
16 | }
17 |
18 | .close-button {
19 | transition: all 0.5s ease;
20 | position: absolute;
21 | background-color: #e85f99;
22 | padding: 3px 3px;
23 | margin-left: -10px;
24 | margin-top: -9px;
25 | border: 2px solid #fff;
26 | color: white;
27 | -webkit-box-shadow: -4px -2px 6px 0px rgba(0, 0, 0, 0.1);
28 | -moz-box-shadow: -4px -2px 6px 0px rgba(0, 0, 0, 0.1);
29 | box-shadow: -3px 1px 6px 0px rgba(0, 0, 0, 0.1);
30 | }
31 |
32 | .close-button:hover {
33 | background-color: #af1c59;
34 | color: #fff;
35 | border: 2px solid #fff;
36 | }
--------------------------------------------------------------------------------
/php/email_base/email_with_html_content.php:
--------------------------------------------------------------------------------
1 |
16 |
17 | HTML email
18 |
19 |
20 |