Skip to content

Instantly share code, notes, and snippets.

{
"code": null,
"site": {
"id": "hh",
"name": "hh.ru"
},
"published_at": "2015-08-18T18:19:28+0300",
"accept_handicapped": false,
"key_skills": [],
"employment": {
@TheBits
TheBits / gist:10020584
Created April 7, 2014 13:46
Periodic call
import threading
import time
class Ti(threading.Thread):
def __init__(self):
print('inittt')
self.k = 1
self.t = None
super().__init__()
#FUNCTION x509_get_info(pem character varying)
# old
from gnutls.crypto import X509Certificate
x=X509Certificate(pem.replace('\r ', '\r\n'))
subj = dict([f.split('=') for f in x.subject.split(',')])
from datetime import datetime
return subj['CN'], datetime.fromtimestamp(x.expiration_time)
#new
#!/usr/bin/env bash
# select "name" from animals_vpnaccount where id in (select vpnaccount from animals_homertunnel where isptunnel in (select id from animals_isptunnel where account in (select id from animals_ispaccount where isp in (select id from animals_isp where name = 'NetByNet')))) order by name;
while read p
do
echo $p
# проверка
curl -w "size: %{size_download}\n\n" -o /dev/null -m 10 -L -x 'botanik.yandex.net:4050' -H "Forward-Via: $p" --silent 'http://static.yandex.net/ok.html' -vv 2>&1 | grep -iE "GET.*HTTP/|Host:|size:"
#!/bin/bash
DSTDIR=$1
WPLATESTGZ=$(mktemp)
wget -O $WPLATESTGZ http://wordpress.org/latest.tar.gz
#cp -v latest.tar.gz $WPLATESTGZ
WPLATESTDIR=$(mktemp -d)
@TheBits
TheBits / o.py
Created September 5, 2010 17:28
# coding=utf-8
import re
# simple css parser
SELECTOR = '^\s*([#-_\.a-z\s:\(\)]+?)\s*({)'
PROPERTIES = '^\s*([-a-z]*?\s*:?\s*.*?)\s*(})'
SELECTOR_SEPARATOR = ','
PROPERTIES_SEPARATOR = ';'
var a = 10;
loop = setInterval( fadeout, 100 );
function fadeout() {
if( a > 0 ) {
a -= 2;
alert(a/10)
} else {
clearInterval( loop );
}
}
# -*- coding: utf-8 -*-
# ha-ha!
import itertools
DICTIONARY = 'abc123'
LIMIT = 3
out_file = 'out.log'
with open(out_file, 'w') as file:
for i in itertools.product(DICTIONARY, repeat=LIMIT):
@TheBits
TheBits / gist:923006
Created April 16, 2011 09:16
Small Basic plasma
window_x = 320
window_y = 240
'GraphicsWindow.BackgroundColor = "Black"
GraphicsWindow.Title = "Plasma"
GraphicsWindow.Width = window_x
GraphicsWindow.Height = window_y
GraphicsWindow.Show()
t = Math.GetRandomNumber(1000) * 1.0
#include <Windows.h>
int main(){
HKEY hKey;
if (RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Run"), 0, KEY_WRITE, &hKey) == ERROR_SUCCESS)
{
TCHAR str[] = TEXT("D:\\putty.exe");
RegSetValueEx(hKey, TEXT("Putty"), 0, REG_SZ, (LPBYTE)&str, sizeof(str));
RegCloseKey(hKey);