Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Making Ultralisp.org

Alexander Artemenko svetlyak40wt

💭
Making Ultralisp.org
View GitHub Profile
View gist:10140018
#!/usr/bin/env python
# Quick and dirty demonstration of CVE-2014-0160 by
# Jared Stafford (jspenguin@jspenguin.org)
# Modified so that it finds cookies
import sys
import struct
import socket
import time
import select
@svetlyak40wt
svetlyak40wt / cached_mixin.py
Last active Aug 29, 2015
Cache mixin for Django class based views.
View cached_mixin.py
class CachedMixin(object):
def get(self, *args, **kwargs):
cache_key, cache_ttl = self.get_cache_params(*args, **kwargs)
response = cache.get(cache_key)
if response is None:
response = super(CachedMixin, self).get(*args, **kwargs)
response.render()
cache.set(cache_key, response, cache_ttl)
return response
@svetlyak40wt
svetlyak40wt / pillar:firewall.sls
Created Jun 18, 2014
A module for SaltStack to setup firewall rules across many machines (change : to backslashes)
View pillar:firewall.sls
firewall:
groups:
all: [clupea, salmon, skate]
test: [clupea]
rules:
clupea:
- port: 22
- port: 80
View bad-megafon-certificate-test.sh
% openssl s_client -connect lk.megafon.ru:443 -verify 3
verify depth is 3
depth=0 /1.3.6.1.4.1.311.60.2.1.3=RU/businessCategory=Private Organization/serialNumber=1027809169585/C=RU/ST=Moscow/L=Moscow/O=OJSC MegaFon/CN=lk.megafon.ru
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 /1.3.6.1.4.1.311.60.2.1.3=RU/businessCategory=Private Organization/serialNumber=1027809169585/C=RU/ST=Moscow/L=Moscow/O=OJSC MegaFon/CN=lk.megafon.ru
verify error:num=27:certificate not trusted
verify return:1
depth=0 /1.3.6.1.4.1.311.60.2.1.3=RU/businessCategory=Private Organization/serialNumber=1027809169585/C=RU/ST=Moscow/L=Moscow/O=OJSC MegaFon/CN=lk.megafon.ru
verify error:num=21:unable to verify the first certificate
View site-desired.js
console_app.controller("MyCtrl", list("$scope", "$http", (function($scope, $http) {
return console.log("DONE");
})));
@svetlyak40wt
svetlyak40wt / unittest.lisp
Last active Aug 29, 2015
Фреймворк для юнит-тестирования на jisp
View unittest.lisp
(= tests `())
(def pr line
(process.stdout.write line))
(def prn line
(pr (+ line "\n")))
(mac test name ...body
View effort-summary-test.org

To update clock summary, place cursor on BEGIN and press C-c C-c.

Clock summary at [2014-07-31 Thu 12:39]

EffortHeadlineTime
Total time0:55
Top Level Item0:55
@svetlyak40wt
svetlyak40wt / blocks.py
Created Aug 2, 2014
Кусок адского мега-фреймворка, по типу БЭМ, но для питона и извращений типа bem-tools :)
View blocks.py
# ...
def block(**modifiers):
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
"""Этот декоратор реализует отложенный вызов функции, которую он декорирует.
По сути, он возвращает promice, который при вызове, уже зовет реальную функцию.
"""
def ret():
@svetlyak40wt
svetlyak40wt / salt-shell-shock-checker.sh
Last active Aug 29, 2015
How to check with Salt if your servers are in danger because of ShellShock.
View salt-shell-shock-checker.sh
# first check
sudo salt '*' cmd.run \
'bash -c "echo Bash Test"' \
'env={"VAR": "() { :;}; echo Bash is vulnerable.", "FUNCTION()": "() { :;}; echo Bash is vulnerable."}'
# and then upgrade if needed
sudo salt '*' cmd.run \
'apt-get update && apt-get install --only-upgrade bash'
View 11batons.py
kupi_baton()
if there_are_eggs_on_the_shell():
for x in range(10):
kupi_baton()