Skip to content

Instantly share code, notes, and snippets.

View bashkirtsevich's full-sized avatar
:octocat:
bashkirtsevich.github.io

D.A.Bashkirtsev bashkirtsevich

:octocat:
bashkirtsevich.github.io
View GitHub Profile
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.utils.data as data
from torch.autograd import Variable
from tqdm import tnrange, tqdm_notebook, tqdm
"""My attempt at Karpathy's char-rnn from the unreasonableness of RNNs post
@bashkirtsevich
bashkirtsevich / pytorch_gru.py
Created June 24, 2019 18:43 — forked from kenzotakahashi/pytorch_gru.py
PyTorch GRU example with a Keras-like interface.
import numpy as np
from sklearn.model_selection import train_test_split
import torch
import torch.nn as nn
from torch.autograd import Variable
np.random.seed(1337)
MAX_LEN = 30
@bashkirtsevich
bashkirtsevich / demo1.py
Created May 30, 2019 18:15
Asyncio socket
import asyncio, socket
async def handle_client(client):
request = None
while request != 'quit':
request = (await loop.sock_recv(client, 255)).decode('utf8')
response = str(eval(request)) + '\n'
await loop.sock_sendall(client, response.encode('utf8'))
client.close()
@bashkirtsevich
bashkirtsevich / sha1.sh
Created May 27, 2019 08:24
sha1sum of directory
find . -type f \( -exec sha1sum "$PWD"/{} \; \) | sha1sum
@bashkirtsevich
bashkirtsevich / debian-strongswan.md
Created April 24, 2019 06:51 — forked from andrewlkho/debian-strongswan.md
Setting up a secure VPN with strongSwan on debian

With heightening concern regarding the state of internet privacy (fuelled in part by the passing of the Investigatory Powers Act in the UK), I have set up a VPN server on the virtual server I have hosted with Mythic Beasts. This uses strongSwan and certificate-based IKEv2 authentication.

Assumptions:

  • Debian Jessie server already set up and accessible via debian.example.com, a public IPv4 of 203.0.113.1 and a public IPv6 of 2001:db8::1
  • Client username of me
  • Clients are running the latest versions of macOS and iOS (Sierra and 10 respectively at the time of writing)
  • No need to support any other operating systems (although the setup is easily translated)

For automated deployment of a similar setup, albeit Ubuntu-based and using ansible for deployment, I recommend you take a look at Algo VPN. I used that project as a basis for my configuration.

@bashkirtsevich
bashkirtsevich / IndexedDB101.js
Created April 16, 2019 08:17
Very Simple IndexedDB Example
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
// Open (or create) the database
var open = indexedDB.open("MyDatabase", 1);
// Create the schema
open.onupgradeneeded = function() {
var db = open.result;
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"});
@bashkirtsevich
bashkirtsevich / readme.md
Last active April 24, 2019 18:26
iptables add rule

iptables Как открыть порты в CentOS 6.4 Linux

https://www.first2host.co.uk/f/open-port-iptables/

Для нормальной работы Web сервера на Centos 6.3 на Web сервере необходимо открыть следующие порты:

22 ssh

80 http

@bashkirtsevich
bashkirtsevich / README.md
Last active March 2, 2019 09:14
Confluence and Jira

Copy files to your host.

Run following commands:

docker-compose -f confl.yml -p confl up -d
docker-compose -f jira.yml -p jira up -d
@bashkirtsevich
bashkirtsevich / demo.py
Last active February 15, 2019 08:30
Google image search
# Python 3.7
import asyncio
import json
import os
import re
import aiofiles
from aiohttp import ClientSession, ClientTimeout
@bashkirtsevich
bashkirtsevich / articles.txt
Created January 20, 2019 08:05
mrakopedia articles
Fallout_2
Fallout_Effect
Восемнадцать
Нью_Вегас
Числовая_радиостанция_(Fallout_3)
0005b635
DeadWarrior
Herobrine
Minecraft_Месть_Раны
Во_время_простуды