Skip to content

Instantly share code, notes, and snippets.


Michael Mahemoff mahemoff

View GitHub Profile
erikig / common-domain-prefix-suffix-list.tsv
Last active Jul 12, 2022
Top 5000 Most Common Domain Prefix/Suffix List - Courtesy LeanDomainSearch -
View common-domain-prefix-suffix-list.tsv
Rank Type Prefix/Suffix
1. Prefix my+
2. Suffix +online
3. Prefix the+
4. Suffix +web
5. Suffix +media
6. Prefix web+
7. Suffix +world
8. Suffix +net
9. Prefix go+
diegopacheco /
Created Aug 10, 2016
How to Delete All Data in Elasticsearch?
curl -XDELETE localhost:9200/*
dimitrismistriotis /
Last active Dec 9, 2021
Migrating to new Linux checklist
View rack_gc_heap_instrumentation.rb
require 'statsd'
class RackGcHeapInstrumentation
def initialize(app)
@app = app
@statsd ='localhost', 8125)
def call(env)
GC.enable # Ensure garbage colletion is enabled
ret =
coleww / gist:55cea96ff08dd30af611
Created Jul 18, 2014
weighted shuffle in ruby.
View gist:55cea96ff08dd30af611
things.sort_by do |thing|
-((thing.created_at.to_f / * rand)
kimmobrunfeldt / node-exports-styles.js
Last active Nov 23, 2021
A few Node module export styles. 1 seems to be the most used and I prefer it
View node-exports-styles.js
// Style 1
// Export all manually
// Good: Calling functions inside the module is convenient
// Bad: module.exports becomes verbose and it's tedious to add new functions
function a() {
marcusphi / ansible_conditionals_examples.yaml
Created Oct 2, 2013
Ansible 1.3 Conditional Execution -- Very complete example with comments -- I find the conditional expressions to be ridiculously hard to get right in Ansible. I don't have a good model of what's going on under the surface so I often get it wrong. What makes it even harder is that there has been at least three different variants over the course …
View ansible_conditionals_examples.yaml
# This has been tested with ansible 1.3 with these commands:
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=false"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=true"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts"
# NB: The type of the variable is crucial!
- name: Ansible Conditionals Examples
hosts: $hosts
burke /
Last active May 18, 2022
This sets up keybindings in tmux that allow you to copy/paste to/from your OS X clipboard from tmux running inside an SSH connection to a remote host. Partially borrowed from

Local (OS X) Side


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">
jrochkind /
Created Oct 15, 2012
Truncating html with nokogiri, with/without Rails

Rails has a handy truncate helper (which is actually mostly a method added to String ), but it warns you it's not safe to use on html source, it'll cut off end tags and such.

What if you want an HTML safe one? There are a variety of suggested solutions you can google, none of which were quite robust/powerful enough for me.

So I started with my favorite, by Andrea Singh, using nokogiri.


  • I modified it to not monkey-patch Nokogiri, but be a static method instead (sadly making already confusing code yet more confusing, but I didn't want to monkey patch nokogiri)
marktheunissen / pedantically_commented_playbook.yml
Last active Jun 6, 2022 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
View pedantically_commented_playbook.yml
This playbook has been removed as it is now very outdated.