Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Mahemoff mahemoff

View GitHub Profile
@erikig
erikig / common-domain-prefix-suffix-list.tsv
Last active Jul 12, 2022
Top 5000 Most Common Domain Prefix/Suffix List - Courtesy LeanDomainSearch - https://leandomainsearch.com/top-domain-name-prefixes-and-suffixes/
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
diegopacheco / elasticsearch-es-delete-all-data.md
Created Aug 10, 2016
How to Delete All Data in Elasticsearch?
View elasticsearch-es-delete-all-data.md
curl -XDELETE localhost:9200/*
@dimitrismistriotis
dimitrismistriotis / checklist.md
Last active Dec 9, 2021
Migrating to new Linux checklist
View checklist.md
View rack_gc_heap_instrumentation.rb
require 'statsd'
class RackGcHeapInstrumentation
def initialize(app)
@app = app
@statsd = Statsd.new('localhost', 8125)
end
def call(env)
GC.enable # Ensure garbage colletion is enabled
ret = @app.call(env)
@coleww
coleww / gist:55cea96ff08dd30af611
Created Jul 18, 2014
weighted shuffle in ruby.
View gist:55cea96ff08dd30af611
things.sort_by do |thing|
-((thing.created_at.to_f / Time.now.to_f) * rand)
end
@kimmobrunfeldt
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() {
b()
}
@marcusphi
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
vars_files:
@burke
burke / remotepaste.md
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 http://seancoates.com/blogs/remote-pbcopy
View remotepaste.md

Local (OS X) Side

~/Library/LaunchAgents/pbcopy.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
     <key>Label</key>
     <string>localhost.pbcopy</string>
@jrochkind
jrochkind / Explanation.md
Created Oct 15, 2012
Truncating html with nokogiri, with/without Rails
View Explanation.md

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.

But:

  • 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
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.