Skip to content

Instantly share code, notes, and snippets.

while true; do git pull && notify-send 'It works again!' && break; sleep 5s; done
(ls ~ & echo $! > /tmp/pid) | grep 'text'; cat /tmp/pid
convert source.png -resize 128x128 -normalize -equalize -posterize 4 -colors 8 -unique-colors -scale 1000% colors.png
@scaint
scaint / gist:56170113fab974b978b7
Created February 25, 2015 11:08
Rename some_file.js => some_file.js.coffee in Vim
:sav %.coffee | bd# | !rm #
@scaint
scaint / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@scaint
scaint / web.sh
Created March 18, 2015 19:37
A simplest "web server" shell script
#!/bin/sh
while :; do nc -l 9292 <<< $'HTTP/1.1 200 OK\r\nHello, world!'; done
@scaint
scaint / gist:005c44ae7e06705de1b2
Created March 29, 2015 16:36
How to install specified Rust build
# List of available dates you can see at https://static.rust-lang.org/dist/
curl -s https://static.rust-lang.org/rustup.sh | sudo sh -s -- --date="2015-03-25"
input_array = [1, 2, 1, 4, 1.0, 1r]
require 'set'
Set.new(input_array).to_a
# => [1, 2, 4, 1.0, (1/1)]
unique_elements = []
input_array.each { |el| unique_elements << el unless unique_elements.include?(el) }
unique_elements
# => [1, 2, 4]
public.class_eval { def say_hello; 'Hello!'; end }
:ruby.say_hello # => "Hello!"
Object.class_eval { def self.private; Object; end }
def MyClass
private
def some_method
end
end
MyClass.private_instance_methods.include? :some_method # => false