Skip to content

Instantly share code, notes, and snippets.

Rank Type Prefix/Suffix Length
1 Prefix my+ 2
2 Suffix +online 6
3 Prefix the+ 3
4 Suffix +web 3
5 Suffix +media 5
6 Prefix web+ 3
7 Suffix +world 5
8 Suffix +net 3
9 Prefix go+ 2
@diegopacheco
diegopacheco / elasticsearch-es-delete-all-data.md
Created August 10, 2016 21:36
How to Delete All Data in Elasticsearch?
curl -XDELETE localhost:9200/*
@dimitrismistriotis
dimitrismistriotis / checklist.md
Last active June 20, 2023 08:56
Migrating to new Linux checklist
  • Additional keyboard
  • New Github/Gitlab certificate, or copy existing
  • MP3s
  • Videos
  • Txts with notes
  • Documents
  • Pycharm
  • Codium editor, settings, package manager, and packages
  • Codium editor: export/import profile from more recent installation
  • Other projects
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 July 18, 2014 14:11
weighted shuffle in ruby.
things.sort_by do |thing|
-((thing.created_at.to_f / Time.now.to_f) * rand)
end
@kimmobrunfeldt
kimmobrunfeldt / node-exports-styles.js
Last active July 1, 2023 18:39
A few Node module export styles. 1 seems to be the most used and I prefer it
// 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 October 2, 2013 09:48
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 …
---
# 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 September 26, 2023 11:04
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

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 October 15, 2012 17:19
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.

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 March 31, 2024 18:45 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.