Skip to content

Instantly share code, notes, and snippets.

View alexanderadam's full-sized avatar
⌨️
⌨️

Alexander ADAM alexanderadam

⌨️
⌨️
View GitHub Profile
@alexanderadam
alexanderadam / no-comments.js
Created February 21, 2018 13:42 — forked from Darep/no-comments.js
Remove all comments from GitHub Pull Request
// Sometimes it's necessary to do a bit of clean-up
Array.prototype.forEach.call(document.querySelectorAll('.js-comment-delete button'), function(el, i) {
el.removeAttribute('data-confirm');
el.click();
});
@alexanderadam
alexanderadam / install-latest-compose.sh
Created August 31, 2017 07:13 — forked from deviantony/install-latest-compose.sh
Install latest version of Docker Compose
#!/bin/bash
# get latest docker compose released tag
COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4)
# Install docker-compose
sh -c "curl -L https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose"
chmod +x /usr/local/bin/docker-compose
sh -c "curl -L https://raw.githubusercontent.com/docker/compose/${COMPOSE_VERSION}/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose"
@alexanderadam
alexanderadam / getBlockLists.sh
Created May 5, 2017 19:40 — forked from johntyree/getBlockLists.sh
Make one large blocklist from the bluetack lists on iblocklist.com
#!/usr/bin/env sh
# Download lists, unpack and filter, write to stdout
curl -s https://www.iblocklist.com/lists.php \
| sed -n "s/.*value='\(http:.*=bt_.*\)'.*/\1/p" \
| xargs wget -O - \
| gunzip \
| egrep -v '^#'
require "json"
require "yaml"
require "secure_random"
class SerializableKlass
YAML.mapping({
bool: { type: Bool, nilable: true},
float: { type: Float64, nilable: true},
int: { type: Int32, nilable: true},
str: { type: String, nilable: true}
@alexanderadam
alexanderadam / ctags.cr
Created March 24, 2017 21:46 — forked from fernandes/ctags.cr
Generates ctags for a Crystal source - Crystal 0.17.4 [9d258f6] (2016-06-05)
# Generates ctags for a Crystal source
# Based on asterite script https://github.com/crystal-lang/crystal/issues/577#issuecomment-97054600
# This works on Crystal 0.17.4 [9d258f6] (2016-06-05)
#
require "compiler/crystal/**"
require "option_parser"
include Crystal
class CTagsVisitor < Visitor
!!! Strict
%html{:xmlns => 'http://www.w3.org/1999/xhtml'}
%head
%meta{'http-equip' => 'Content-Type', :content => 'text/html; charset=utf-8'}
%meta{:name => 'viewport', :content => 'widt=device-width, initial-scale=1.0'}
%title= subject
:css
/* Based on The MailChimp Reset INLINE: Yes. */
/* Client-specific Styles */
#outlook a {padding:0;} /* Force Outlook to provide a "view in browser" menu link. */
@alexanderadam
alexanderadam / db.rake
Last active October 19, 2016 12:10 — forked from hopsoft/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc 'Dumps the database to db/APP_NAME.dump'
task dump: :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump #{pg_options(host, user)} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
exec cmd
@alexanderadam
alexanderadam / Rakefile.rb
Created February 12, 2016 16:56 — forked from nimf/Rakefile.rb
I found this in the answer by Jason to this question http://stackoverflow.com/questions/19206764/how-can-i-load-activerecord-database-tasks-on-a-ruby-project-outside-rails. This is a Rakefile for using ActiveRecord without Rails. It loads ActiveRecord's databases.rake file making ActiveRecord rake tasks available for your non-rails app.
require 'bundler/setup'
require 'active_record'
include ActiveRecord::Tasks
class Seeder
def initialize(seed_file)
@seed_file = seed_file
end
@alexanderadam
alexanderadam / REAME.md
Created December 3, 2015 11:38 — forked from romansklenar/REAME.md
How to set up your VPS with Chef Solo

How to set up your VPS with Chef Solo

1. What is it?

There are many different provisioning tools out there, the most popular of which are Chef and Puppet. Chef uses Ruby, Puppet uses a DSL (Domain Specific Language), there are others that use simple bash too, but today we're going to focus on Chef Solo.

2. Dependencies

To get Chef working properly on your local machine you need a few things.

Make sure you use Ruby 1.9.x and not Ruby 2.x as you will get errors with the json 1.6.1 gem on 2.x. Use rbenv or RVM to manage several different Rubies on the one machine.

@alexanderadam
alexanderadam / squeezebox.coffee
Created October 23, 2015 13:30 — forked from kylefritz/squeezebox.coffee
Control Squeezebox Through Hubot [Must be a firmware version pre "UE Smart Radio"; e.g. must work with http://www.mysqueezebox.com]
# Description:
# Allows Hubot to control pandora on a squeezebox music player.
# Also plays a generic internet radio station via play.
#
# Dependencies:
# none
#
# Configuration:
# SQUEEZE_BOX_EMAIL (for mysqueezebox.com)
# SQUEEZE_BOX_PASSWORD