Skip to content

Instantly share code, notes, and snippets.

@leventov
leventov / analyze.py
Created September 4, 2014 23:53
См. http://habrahabr.ru/post/235689/. Инструкция по применению в первом комментарии
import json
MIN_STARS = 700
with open('{}.json'.format(MIN_STARS)) as json_file:
repos = json.load(json_file)
repos_by_language = {}
by_top = {}
for repo in repos:
#!/bin/bash
# Перекодирует рекурсивно в текущем каталоге имена
# файлов и каталогов в транслит.
shopt -s nullglob
for NAME in * ; do
TRS=`echo $NAME | sed "y/абвгдезийклмнопрстуфхцы /abvgdezijklmnoprstufxcy_/"`
TRS=`echo $TRS | sed "y/АБВГДЕЗИЙКЛМНОПРСТУФХЦЫ/ABVGDEZIJKLMNOPRSTUFXCY/"`
TRS=${TRS//ч/ch};
@bessangel
bessangel / mtop
Created June 16, 2011 16:19
mtop.sh - mysql top
#!/bin/bash
if [ ! -z $1 ]; then
export MTOPU="-uroot"
export MTOPPW="-p$1"
fi
if [ -f /root/.my.cnf ]; then
MTOPU=' '
MTOPPW=' '
fi
if [ -z $MTOPU ] && [ -z $MTOPPW] && [ $MTOPU != ' ' ]; then
# Windows AMIs don't have WinRM enabled by default -- this script will enable WinRM
# AND install 7-zip, curl and .NET 4 if its missing.
# Then use the EC2 tools to create a new AMI from the result, and you have a system
# that will execute user-data as a PowerShell script after the instance fires up!
# This has been tested on Windows 2008 SP2 64bits AMIs provided by Amazon
#
# Inject this as user-data of a Windows 2008 AMI, like this (edit the adminPassword to your needs):
#
# <powershell>
# Set-ExecutionPolicy Unrestricted
@g-k
g-k / gpg-git-smudge-clean.md
Last active June 22, 2022 07:16
test transparent git encryption with smudge clean filters using gpg

Generate a GPG Key and revocation cert per http://www.gnupg.org/gpg/en/manual.html:

gpg --key-gen
gpg --output revoke.asc --gen-revoke <my user ID or email>

Once gpg key in keyring we can encrypt and decrypt files.

pfSsh.php playback disablereferercheck
@yukaizhao
yukaizhao / NIOClient.java
Created October 7, 2015 01:24
nio client example
package cn.outofmemory.hello.nio;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
@jsoma
jsoma / .gitignore
Last active March 13, 2023 23:08
Tutorial on how to build a most-popular-thing-in-a-grid map in QGIS and pandas
.DS_Store
@jpawlowski
jpawlowski / msys_hetzner-etc_network_interfaces
Created August 12, 2012 12:06
Debian network configuration for Proxmox VE server running on a Hetzner host
# /etc/network/interfaces
#
auto lo
iface lo inet loopback
# device: eth0
iface eth0 inet manual
# IPv4 bridge
# (connect ONLY your firewall/router KVM instance here, this is the WAN device!)
@morhekil
morhekil / nginx.conf
Created August 14, 2014 12:18
Full request/response body logging in nginx
http {
log_format bodylog '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" $request_time '
'<"$request_body" >"$resp_body"';
lua_need_request_body on;
set $resp_body "";
body_filter_by_lua '