Skip to content

Instantly share code, notes, and snippets.

View vtols's full-sized avatar
😼

Valery Tolstov vtols

😼
View GitHub Profile
@vtols
vtols / vk.sh
Created August 24, 2012 05:59
Test
#!/bin/bash
echo -n 'EMail: '
read MAIL
echo -n 'Password: '
stty -echo
read PASS
stty echo
curl -c cookie "vk.com/login.php?email=$MAIL&pass=$PASS"
USER_ID=$(curl -b cookie 'vk.com/feed' | grep -oE 'events_queue([0-9]+)' | sed 's/events_queue//')
@vtols
vtols / timeserver.c
Last active December 10, 2015 05:18
#include <stdio.h>
#include <string.h>
#ifdef _WIN32
#include <Windows.h>
#else
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@vtols
vtols / codegen.py
Last active December 10, 2015 05:38
from ctypes import c_int, create_string_buffer, CDLL, CFUNCTYPE
import os, ctypes
PROT_NONE = 0x0
PROT_READ = 0x1
PROT_WRITE = 0x2
PROT_EXEC = 0x4
MAP_PRIVATE = 0x02
MAP_ANONYMOUS = 0x20
import sys
def diff(a, b):
al = a.split('\n')
bl = b.split('\n')
ah = [hash(s) for s in al]
bh = [hash(s) for s in bl]
t = [[0 for j in range(0, len(bl)+1)] for i in range(0, len(al)+1)]
#include <unistd.h>
#include <stdio.h>
int main()
{
if (isatty(fileno(stdout)))
printf("\e[1mIn terminal\e[0m\n");
else
printf("In file or pipe\n");
return 0;
from PIL import Image, ImageDraw
import sys
infile = sys.argv[1]
f = file(infile)
w, h = map(int, f.readline().split()[2::3])
lines = f.readlines()
x = lines[0][0]
im = Image.new('RGB', (w, h), (0, 0, 0))
draw = ImageDraw.Draw(im)
@vtols
vtols / .vimrc
Last active December 14, 2015 09:29
set nu
set autoindent
set expandtab
set smartindent
set ts=4
set sw=4
set softtabstop=4
if has("gui_running")
set guioptions-=T
#include <iostream>
#include <cstring>
#include <map>
#include <vector>
#include <iomanip>
#include <string>
using namespace std;
/*
ifstream cin("in");
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
struct node
{
int top, par, val, sz;
node(int p = 0, int t = 0, int s = 0, int v = 0) :
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#define READ_END 0
#define WRITE_END 1
char buf[256];
char text[] = "hello!!\n";