Skip to content

Instantly share code, notes, and snippets.

View studentIvan's full-sized avatar
🎯
Focusing

Ivan Maslov studentIvan

🎯
Focusing
View GitHub Profile
@tgwizard
tgwizard / vcl_deliver.vcl
Last active June 8, 2019 17:31
Fastly VCL config for A/B tests
sub vcl_deliver {
# ----- snip -----
# Set a cookie with the experiment group sequence, if the client didn't
# already have the cookie and provided it in the request, and if the origin
# hasn't already set it. Use `setcookie.get_value_by_name` to handle the
# cases when the backend sets multiple cookies.
# Only do this on the edge nodes, not the origin shield, otherwise the edge
# nodes will see a response with a `Set-Cookie` header and not cache it.
@guss77
guss77 / mongo_db_recover_delete_record-2.4.py
Last active August 26, 2022 05:52
Try to recover deleted documents from a mongodb 2.4 data file. Based on https://gist.github.com/egguy/2788955 with help from https://yazadk.wordpress.com/2015/07/15/a-forensic-perspective-on-recovering-deleted-data-from-big-data-systems/#MongoDB . Make sure to change `decode_chunk` so it properly detects the objects you are trying to recover - i…
#!/usr/bin/python
"""A little script to recover deleted recording of a mongoDB db file
There's no optimization but it work and has saved me
"""
import struct
import bson
import pymongo
@zeroseis
zeroseis / disable-auto-android-file-transfer.md
Created September 14, 2015 17:28
Disable auto start for Android File Transfer
  • Close Android File Transfer
  • Open Activity Monitor and kill “Android File Transfer Agent”
  • Go to where you installed “Android File Transfer.app” (I have it under /Applications)
  • Ctrl+click –> “Show package contents”
  • Go to Contents/Resources
  • Rename “Android File Transfer Agent” to e.g. “Android File Transfer Agent_DISABLED”
  • Then go to “/Users/username/Library/Application Support/Google/Android File Transfer” and again rename the Agent app.
@dcramer
dcramer / args.py
Last active June 1, 2021 14:28
Python Standards (that I would change and enforce if I could)
# dont do this
this_function_name(foo, bar
baz)
# do this
cramers_version(
foo, bar, baz)
# allow this
cramers_version(foo, bar,
@jterrace
jterrace / xvfb
Created June 11, 2012 18:46
xvfb init script for Ubuntu
XVFB=/usr/bin/Xvfb
XVFBARGS=":1 -screen 0 1024x768x24 -ac +extension GLX +render -noreset"
PIDFILE=/var/run/xvfb.pid
case "$1" in
start)
echo -n "Starting virtual X frame buffer: Xvfb"
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS
echo "."
;;
stop)
@saetia
saetia / gist:1623487
Last active May 1, 2024 19:55
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@mayoff
mayoff / gist:1138816
Last active December 8, 2023 22:00
AppleScript to make Google Chrome open/reload a URL
(* To the extent possible under law, Rob Mayoff has waived all copyright and related or neighboring rights to “AppleScript to make Google Chrome open/reload a URL”. This work is published from: United States. https://creativecommons.org/publicdomain/zero/1.0/ *)
tell application "Google Chrome"
activate
set theUrl to "http://tycho.usno.navy.mil/cgi-bin/timer.pl"
if (count every window) = 0 then
make new window
end if
set found to false