Skip to content

Instantly share code, notes, and snippets.

View s0b0lev's full-sized avatar

Aleksandr Sobolev s0b0lev

  • Kyrgyzstan, Bishkek
  • 23:07 (UTC +05:00)
  • X @as0b0lev
View GitHub Profile
@bradenmacdonald
bradenmacdonald / openedx_client.py
Created May 11, 2021 01:36
Open edX API Client Example
"""
API Client used to make requests from Open edX
Originally created by OpenCraft for LabXchange, www.labxchange.org
You may use this under the terms of the Apache 2 license,
https://www.apache.org/licenses/LICENSE-2.0
"""
import logging
@ssbb
ssbb / 0_README.md
Last active August 29, 2015 14:04
Automatically create Django environment on server.

Usage

./start_env.sh example.com

@frydaykg
frydaykg / gist:7283543
Last active December 27, 2015 06:39
Knapsack problem solution #1
def solve(k, a):
s = sum(a)
if s == k:
return True
elif s < k:
return False
elif len(a) == 1:
return False
else:
@frydaykg
frydaykg / gist:7145609
Last active December 26, 2015 11:39
exploit to promzona.kg
import urllib, urllib2
import md5
email = 're@re.com'
fio = 'abc def'
mes = 'weak captcha'
ciferki = 'her morzhovii'
kod_ciferki = md5.new(ciferki).hexdigest()
headers = { 'email' : email,
@gen1us2k
gen1us2k / caesarCipher.py
Last active December 18, 2015 07:29
Caesar cipher
import string
class CesarCipher(object):
shift = None
alphabet = None
def setAlphabet(self, alphabet):
self.alphabet = alphabet
def setShift(self, shift):
# self.shift = shift % 26 # only 26 chars in alphabet
@Mins
Mins / mysql_secure.sh
Last active February 16, 2024 00:03
Automating mysql_secure_installation
#!/bin/bash
aptitude -y install expect
// Not required in actual script
MYSQL_ROOT_PASSWORD=abcd1234
SECURE_MYSQL=$(expect -c "
set timeout 10
@neoascetic
neoascetic / signals.py
Last active June 29, 2017 17:57
[Django] Optimize easy-thumbnails (PIL) generated images
# On Debian, you need to install these packages:
# jpegoptim optipng pngcrush advancecomp
import subprocess
from os.path import splitext
from django.dispatch import receiver
from easy_thumbnails.signals import saved_file, thumbnail_created
# on-save image optimization
@jboner
jboner / latency.txt
Last active April 26, 2024 03:40
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@afternoon
afternoon / git-slim.py
Created December 5, 2011 14:42
Remove large objects from a git repository
#!/usr/bin/python
#
# git-slim
#
# Remove big files from git repo history.
#
# Requires GitPython (https://github.com/gitpython-developers/GitPython)
#
# References:
# - http://help.github.com/remove-sensitive-data/