Skip to content

Instantly share code, notes, and snippets.

View siriniok's full-sized avatar
🏠
Working from home

Vladyslav Siriniok siriniok

🏠
Working from home
View GitHub Profile
@siriniok
siriniok / bookmarklet.js
Last active January 1, 2022 08:10
A bookmarklet for saving the best pieces of journalism in the Wayback Machine. How-to: https://superuser.com/a/1341468
javascript:((_=>location.href='http://web.archive.org/web/*/'+location.href)())
@siriniok
siriniok / ruby.bash
Last active April 18, 2018 17:16
Get rid of sed and awk with jq and ruby
# Shows the number of AWS IPs
curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | jq '.prefixes[].ip_prefix' | xargs ruby -e "puts ARGV.reduce(0) { |acc, i| acc + 2**(32 - i.split('/')[1].to_i) }"
@siriniok
siriniok / debug.rb
Created January 14, 2018 14:54
My Ruby Debugging Cheatsheet
# Figure out where a method was defined
object = Object.new
puts object.method(:blank?).source_location
# Opening a dependency from a project
$ bundle open active_support
@siriniok
siriniok / example.js
Created November 25, 2017 11:28
Ternary Formatting
return done ? foo(a) : bar(b);
return done == false && exist == true
? foo(a)
: bar(b);
const baz = (a, b) =>
done ? foo(a) : bar(b);
@siriniok
siriniok / index.js
Created September 30, 2017 03:57
Notes from Allonge Six
const _ = require('lodash');
const map = _.map;
const mapWith = (fn) => (list) => map(list, fn);
// Bounding to a name
((diameter_fn) =>
console.log(diameter_fn(2)) //=> 6.2831853
)(
((PI) =>
@siriniok
siriniok / .sh
Last active July 21, 2016 14:35
Download site via wget
wget --limit-rate=200k --no-clobber --convert-links --random-wait -r -p -E -e robots=off -U mozilla http://example.com
# or
download_site () {
wget --limit-rate=200k --no-clobber --convert-links --random-wait -r -p -E -e robots=off -U mozilla $1
}
@siriniok
siriniok / curl wttr.in
Created February 24, 2016 09:38
curl wttr.in
curl wttr.in
@siriniok
siriniok / Better Bash Scripting in 15 Minutes.md
Created January 16, 2016 09:14
Better Bash Scripting in 15 Minutes

Source

Better Bash Scripting in 15 Minutes

The tips and tricks below originally appeared as one of Google's "Testing on the Toilet" (TOTT) episodes.
This is a revised and augmented version.

Safer Scripting

I start every bash script with the following prolog:

@siriniok
siriniok / Dev UA Quotes.md
Last active September 18, 2016 22:00
Dev UA Quotes

Feel free to add new quotes.


blia Dec 22 14:43

форкни фетч еба


Iurii Plugatariov @strangeworks Sep 18 22:09

@siriniok
siriniok / ci
Created August 18, 2015 11:46
Simple Codeship CI, testing and deployment scripts for Rails with Ember CLI frontend
#!/bin/bash
init() {
# Use ruby version specified in .ruby-version file
rvm use $(cat .ruby-version)
# Use Postgress 9.3 version on Codeship (port 5433)
sed -i "s|5432|5433|" "config/database.yml"
# Install gem dependencies