Skip to content

Instantly share code, notes, and snippets.

Ori Livneh atdt

View GitHub Profile
@atdt
atdt / coupon-codes.txt
Created Feb 22, 2019 — forked from ethagnawl/coupon-codes.txt
Top 100 Ecommerce Coupon Codes
View coupon-codes.txt
# source: https://www.slideshare.net/CouponFollow/top-100-most-common-coupon-code-phrases
fall
twitter
black
MEMORIAL
TWEET20
FREESHIP
earlybird
MONDAY
holidays
@atdt
atdt / x.sh
Created Oct 1, 2018 — forked from d630/x.sh
bash: any idea how to use the readline function 'history-and-alias-expand-line' in a recursive way?!
View x.sh
#!/usr/bin/env bash
# Method 1
bind -x '"\C-x4": history_and_alias_expand_line';
bind '"\C-x3": history-and-alias-expand-line';
bind -x '"\C-x2": READLINE_LINE_OLD="$READLINE_LINE"';
bind '"\C-x1": "\C-x2\C-x3\C-x4\C-x5"';
function history_and_alias_expand_line {
@atdt
atdt / links.md
Last active Nov 9, 2017 — forked from eloquence/gist:8750334
Getting involved in Wikimedia as a Technical Contributor
View links.md
View make-client-cert.sh
openssl req -nodes -newkey rsa:4096 -keyout atdt.pem -x509 -days 3650 -out atdt.pem -subj "/CN=atdt"
openssl x509 -sha1 -noout -fingerprint -in atdt.pem | sed -e 's/^.*=//;s/://g;y/ABCDEF/abcdef/'
@atdt
atdt / diffbranches
Created Sep 12, 2016
Diff JavaScript (or any other type of file) across two production branches
View diffbranches
#!/usr/bin/env bash
file_pattern='*.js' # Which files to consider
v1="php-1.28.0-wmf.18" # Base branch
v2="php-1.28.0-wmf.17" # Target branch
while IFS= read -r a; do
b="${a/$v1/$v2}"
diff -u "$a" "$b" # Change '-u' to '-q' if you only want
# to list which files have changed.
done < <(find "/srv/mediawiki/${v1}" -name "$file_pattern")
View detect-mokes.sh
#!/usr/bin/env bash
# Crude script to detect Backdoor.OSX.Mokes.a, as described in
# https://securelist.com/blog/research/75990/the-missing-piece-sophisticated-os-x-backdoor-discovered/
locations=(
"$HOME/Library/App Store/storeuserd"
"$HOME/Library/com.apple.spotlight/SpotlightHelper"
"$HOME/Library/Dock/com.apple.dock.cache"
"$HOME/Library/Skype/SkypeHelper"
"$HOME/Library/Dropbox/DropboxCache"
"$HOME/Library/Google/Chrome/nacld"
@atdt
atdt / takeover.py
Last active Apr 18, 2019
Zero-downtime restarts via interprocess descriptor transfer
View takeover.py
#!/usr/bin/env python3
# -*- coding: utf8 -*-
"""
takeover.py
~~~~~~~~~~~
This script demonstrates a technique for zero-downtime restarts via
interprocess descriptor transfer.
The script operates a simple echo service on port 9999. When a new instance
is launched, the old instance will transfer the server socket to the new
View gist:f8317b8ded7a38feb216decd9cefbb42
import urllib.request
import re
import bs4
def soup_url(url):
req = urllib.request.Request(url)
with urllib.request.urlopen(req) as resp:
return bs4.BeautifulSoup(resp.read(), 'html.parser')
View node-enc.php
<?php
class Node implements JsonSerializable {
public function __construct( $name, $contents ) {
$this->name = $name;
$this->store = [];
foreach ( (array)$contents as $k => $v ) {
if ( is_int( $k ) ) {
$this->addChild( $v );
} else {
$this->addAttribute( $k, $v );
View bpe.js
var assert = require( 'assert' );
function findFrequentBigram( s ) {
var i, freqs = {}, topFreq = 0, topPair = null, bigram;
for ( i = 0; i < s.length; i += 2 ) {
bigram = s.slice( i, i + 2 );
freq = ++freqs[bigram];
You can’t perform that action at this time.