Skip to content

Instantly share code, notes, and snippets.

View psqq's full-sized avatar
🙃
Where is my mind?

Sergey Pestov psqq

🙃
Where is my mind?
View GitHub Profile
Python C++
@psqq
psqq / jupyter_forever.py
Last active November 16, 2016 16:18
jupyter forever for server
from subprocess import Popen
while True:
popen = Popen("jupyter notebook", shell=True)
try:
popen.wait()
except:
pass
popen.kill()
@psqq
psqq / jupyter
Last active November 16, 2016 16:05 — forked from doowon/jupyter
A service (init.d) script for jupyter
#! /bin/sh
### BEGIN INIT INFO
# Provides: jupyter
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start jupyter
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
apt update
apt ugrade
apt install -y python3-pip
pip3 install --upgrade pip
pip3 install jupyter sympy scipy matplotlib
mkdir ~/.jupyter
mkdir notebooks
touch ~/.jupyter/jupyter_notebook_config.py
echo c.NotebookApp.ip = \'*\' > ~/.jupyter/jupyter_notebook_config.py
echo c.NotebookApp.port = 9999 >> ~/.jupyter/jupyter_notebook_config.py
@psqq
psqq / cf.cpp
Created November 3, 2016 15:23
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
vector<pair<int, int>> v;
set<pair<int, int>> ms;
@psqq
psqq / Main.java
Created November 1, 2016 12:34
[Java] File encrypt/decrypt with AES 128
package ru.psqq;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.*;
import java.security.Key;
import java.security.MessageDigest;
import java.util.Base64;
@psqq
psqq / SLAU.cpp
Last active March 27, 2017 12:31
SLAU solvers
#include <iostream>
#include <ostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <limits>
#include <iomanip>
#include <cmath>
using namespace std;
@psqq
psqq / clean.sh
Created September 27, 2016 19:50
apt-get clean
apt-get autoclean
apt-get autoremove
@psqq
psqq / 1.py
Last active September 27, 2016 12:56
A = Matrix([[1, 2], [3, 4]])
B = Matrix([[5, 6], [7, 8]])
C = Matrix([[9, 1], [5, 7]])
n, _ = A.shape
X = Matrix( [ [symbols("x_{}_{}".format(i+1, j+1)) for j in range(n)] for i in range(n) ] )
solve(X*A + B*X - C)
@psqq
psqq / a.cpp
Created September 15, 2016 16:11
files
#include <iostream> // для cout cin
#include <cstdlib> // для system
using namespace std; // пространсто имен std::
int main() {
float s = 0, t; // две переменные
int n;
cout << "Vvedite kolichestvo chisel:";
cin >> n;
for(int i=1; i<=n; ++i)