Skip to content

Instantly share code, notes, and snippets.

View victorkashirin's full-sized avatar

Victor Kashirin victorkashirin

  • ITMO University
  • Rotterdam
View GitHub Profile
@victorkashirin
victorkashirin / mirror-org-repos.sh
Created June 8, 2020 15:27 — forked from benbalter/mirror-org-repos.sh
Mirror all organization repositories
org="whitehouse"
for repo in $(curl -v -s "https://api.github.com/orgs/$org/repos?per_page=100&type=sources" 2>&1 | grep '"full_name": "*"' | cut -d':' -f2 | sed s'/,$//' | sed s'/"//g' ); do
filename=$(echo "$repo" | cut -d'/' -f2)
echo "Downloading $repo..."
curl -o "$filename.zip" -L "https://github.com/$repo/archive/master.zip"
done
@victorkashirin
victorkashirin / postgres-cheatsheet.md
Created May 22, 2020 11:36 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@victorkashirin
victorkashirin / README.md
Created December 12, 2019 12:18 — forked from clhenrick/README.md
PostgreSQL & PostGIS cheatsheet (a work in progress)
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
text-align: center;
}
.state {
fill: none;
}
@victorkashirin
victorkashirin / redis_session_backend.py
Created November 4, 2012 21:40 — forked from mikeyk/redis_session_backend.py
A redis backend for Django Sessions, tested on Django 1.3+
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(
@victorkashirin
victorkashirin / gist:4012672
Created November 4, 2012 17:23 — forked from mikeyk/gist:1329319
Testing storage of millions of keys in Redis
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])