Skip to content

Instantly share code, notes, and snippets.

View atdt's full-sized avatar
💭
I may be slow to respond.

Ori Livneh atdt

💭
I may be slow to respond.
  • Google
  • New York City
View GitHub Profile
@atdt
atdt / homebrew-gnubin.md
Created September 21, 2020 00:55 — forked from skyzyx/homebrew-gnubin.md
Using GNU command line tools in macOS instead of FreeBSD tools

macOS is a Unix, and not built on Linux.

I think most of us realize that macOS isn't a Linux OS, but what that also means is that instead of shipping with the GNU flavor of command line tools, it ships with the FreeBSD flavor. As such, writing shell scripts which can work across both platforms can sometimes be challenging.

Homebrew

Homebrew can be used to install the GNU versions of tools onto your Mac, but they are all prefixed with "g" by default.

All commands have been installed with the prefix "g". If you need to use these commands with their normal names, you can add a "gnubin" directory to your PATH from your bashrc.

@atdt
atdt / coupon-codes.txt
Created February 22, 2019 22:09 — forked from ethagnawl/coupon-codes.txt
Top 100 Ecommerce Coupon Codes
# 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 October 1, 2018 15:16 — forked from d630/x.sh
bash: any idea how to use the readline function 'history-and-alias-expand-line' in a recursive way?!
#!/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 January 12, 2020 00:32 — forked from eloquence/gist:8750334
Getting involved in Wikimedia as a Technical Contributor
@atdt
atdt / ProFi.lua
Created October 27, 2015 09:01 — forked from perky/ProFi.lua
ProFi, a simple lua profiler that works with LuaJIT and prints a pretty report file in columns.
--[[
ProFi v1.3, by Luke Perkin 2012. MIT Licence http://www.opensource.org/licenses/mit-license.php.
Example:
ProFi = require 'ProFi'
ProFi:start()
some_function()
another_function()
coroutine.resume( some_coroutine )
ProFi:stop()
@atdt
atdt / term_colors.py
Created October 20, 2015 20:24 — forked from christian-oudard/term_colors.py
Terminal output colors in python
from __future__ import print_function
"""
Utilities for 256 color support in terminals.
Adapted from:
http://stackoverflow.com/questions/1403353/256-color-terminal-library-for-ruby
The color palette is indexed as follows:
0-15: System colors
@atdt
atdt / what-forces-layout.md
Last active September 19, 2015 17:30 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@atdt
atdt / parser.py
Created September 4, 2013 18:47 — forked from vvuksan/parser.py
from socket import *
from xdrlib import Packer, Unpacker
# Set the socket parameters
host = "localhost"
port = 1234
buf = 1024
addr = (host,port)
slope_str2int = {'zero':0,
function debugAccess(obj, prop, debugGet){
var origValue = obj[prop];
Object.defineProperty(obj, prop, {
get: function () {
if ( debugGet )
debugger;
return origValue;
},