Skip to content

Instantly share code, notes, and snippets.

View AlexKMDev's full-sized avatar

Alex AlexKMDev

View GitHub Profile
@AlexKMDev
AlexKMDev / gist:89eb9916eb5b69f62d5f
Last active August 29, 2015 14:03
simple Nginx directory listing
server {
listen 8085;
root /home/debian-transmission/downloads;
charset utf8;
location / {
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
@AlexKMDev
AlexKMDev / crontab.sh
Last active August 29, 2015 14:04
homebrew outdated packages notification
# put this to crontab
@daily ~/notify.sh
# for automatic updates (not upgrades)
@daily /usr/local/bin/brew update > /dev/null 2>&1
@AlexKMDev
AlexKMDev / rbenv.sh
Last active August 29, 2015 14:05
rbenv system wide install on linux
git clone https://github.com/sstephenson/rbenv.git /usr/local/rbenv
echo '# rbenv setup' > /etc/profile.d/rbenv.sh
echo 'export RBENV_ROOT=/usr/local/rbenv' >> /etc/profile.d/rbenv.sh
echo 'export PATH="$RBENV_ROOT/bin:$PATH"' >> /etc/profile.d/rbenv.sh
echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh
chmod +x /etc/profile.d/rbenv.sh
source /etc/profile.d/rbenv.sh
@AlexKMDev
AlexKMDev / phantomjs.diff
Last active August 29, 2015 14:07
phantomjs reset cache patch
diff --git a/src/consts.h b/src/consts.h
index 0eb5178..0a88ef1 100644
--- a/src/consts.h
+++ b/src/consts.h
@@ -54,6 +54,7 @@
"document.body.appendChild(el);"
#define PAGE_SETTINGS_LOAD_IMAGES "loadImages"
+#define PAGE_SETTINGS_CLEAR_MEMORY_CACHES "clearMemoryCaches"
#define PAGE_SETTINGS_JS_ENABLED "javascriptEnabled"
@AlexKMDev
AlexKMDev / gist:4b4d8582697f100f3c06
Created January 9, 2015 11:49
install sqlite3 gem on FreeBSD 10.1
CONFIGURE_ARGS="with-sqlite3-include=/usr/local/include with-opt-dir=/usr/local" gem install sqlite3
@AlexKMDev
AlexKMDev / keybase.md
Created January 9, 2015 13:54
keybase proof

Keybase proof

I hereby claim:

  • I am anakros on github.
  • I am anakros (https://keybase.io/anakros) on keybase.
  • I have a public key whose fingerprint is 7703 AD78 D008 E9FC 6F1F 4B06 5178 FA7B 12B3 9C0B

To claim this, I am signing this object:

@AlexKMDev
AlexKMDev / base64tobin.rb
Created May 28, 2015 10:48
convert base64-encoded png to binary
require 'base64'
unless ARGV.first.nil?
file = File.new ARGV.first, 'r'
encoded = file.gets
decoded = Base64.decode64 encoded
file.close
output = File.new "#{ARGV.first}.png", 'w'
#!/usr/bin/env ruby
require 'em-http-request'
require 'json'
def send_m(m, recipient)
token = ''
base = 'https://api.telegram.org/bot'
uri = "#{base}#{token}/sendMessage"
#!/bin/sh
if [ -z "$3" ]
then
echo "usage: $0 background.png lgbt.svg output.png"
exit 1
fi
bg_size=$(identify -format '%wx%h' "$1")
convert -resize $bg_size\! $2 -density 1200 -alpha set -channel A -evaluate set 40% $2.png
convert -composite "$1" "$2.png" -geometry $bg_size+0+0 -depth 8 "$3"
@AlexKMDev
AlexKMDev / install.sh
Last active November 12, 2018 06:30
homebrew nginx http/2
brew install nginx --devel --with-http2
# or
brew install https://gist.githubusercontent.com/Anakros/1891d0b4ec3ca2e34d97/raw/1d75c84f784845047aa7fb52b06becf9c1350da4/nginx.rb --with-http2 --devel