Skip to content

Instantly share code, notes, and snippets.

View denji's full-sized avatar
🇺🇦

Denis Denisov denji

🇺🇦
View GitHub Profile
@denji
denji / linux-kernel-building.txt
Created April 2, 2013 13:37
Build Linux Kernel
apt-get install build-essential
git clone http://evilpiepirate.org/git/linux-bcache.git
git checkout origin/bcache-3.2
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
git checkout v3.2.28
diff -Nru -x .git ./linux-stable/ ./linux-bcache/ > bcache.patch
patch -p1 < /usr/src/bcache.patch
@denji
denji / README.md
Created April 4, 2013 16:57 — forked from nicerobot/README.md
Uninstall NodeJS Mac OS X

To run this, you can try:

curl -ks https://gist.github.com/nicerobot/2697848/raw/uninstall-node.sh | bash

I haven't tested this script doing it this way but i run a lot of my Gists like this so maybe this one'll work too.

Alternatively,

curl -ksO https://gist.github.com/nicerobot/2697848/raw/uninstall-node.sh

bash ./uninstall-node.sh

#For jpeg files
#Need to install jpegtran in ubuntu
sudo apt-get install libjpeg-progs
Usage tips:
#To optimise a single jpeg image:
jpegtran -copy none -optimise -outfile image.jpg image.jpg
#To optimise all jpegs in the current directory:
for img in `ls *.jpg`; do jpegtran -copy none -optimise -outfile $img $img; done
@denji
denji / 0. nginx_setup.sh
Last active December 16, 2015 12:08 — forked from mikhailov/0. nginx_setup.sh
NGINX+SPDY with Unicorn. True Zero-Downtime unless migrations. Best practices.
# Nginx+Unicorn best-practices congifuration guide. Now with SPDY!
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
@denji
denji / vfy.rb
Created May 16, 2013 23:20
The following ruby script compares two directories recursively, and alerts the user of any differences. It compares files by size and (optionally) by a random sample of contents. The results are summarized into a difference percentage so it can be used to easily determine if a backup is valid and recent. https://defuse.ca/backup-verify-script.htm
#!/usr/bin/env ruby
# Author: havoc
# WWW: https://defuse.ca/backup-verify-script.htm
# Date: Jul 28, 2012
# License: Public domain / Do whatever you want.
#
# Backup validator script. Compares two folders "original" and "backup".
# Alerts the user of any files or directories that are in "original" but not in
# "backup" (extra files in "backup" are ignored). If a file exists in both

VP8 vs H.264 - Which One is Better?

So I was reading Hacker News and decided to read the comments in the thread about H.265 being approved. Pretty close to the top was this comment about VP9, Google's future video format. I have some words of my own about it and other future formats at the bottom of this post, but what jumped out from the comment to me was this part:

Many have already implemented VP8 (which is also slightly better than h.264 at this point)

The comparison linked to back up that statement is faulty for several reasons, such as not providing the source material used (hell, he doesn't even name the source material), exact encoding settings used (no, some random profiles are not enough), not providing the resulting encodes, only providing a

@denji
denji / README.md
Last active December 18, 2015 09:19 — forked from ngauthier/README.md
Ruby deploy package Debian (*.deb) ruby-2.1.1 https://www.ruby-lang.org/en/news/2014/02/24/ruby-2-1-1-is-released/

The new Secure Password Hashing API in PHP 5.5

The [RFC for a new simple to use password hashing API][rfc] has just been accepted for PHP 5.5. As the RFC itself is rather technical and most of the sample codes are something you should not use, I want to give a very quick overview of the new API:

Why do we need a new API?

Everybody knows that you should be hashing their passwords using bcrypt, but still a surprising number of developers uses insecure md5 or sha1 hashes (just look at the recent password leaks). One of the reasons for this is that the crypt() API is ridiculously hard to use and very prone to programming mistakes.

Key was generated using:
tom% openssl genrsa -des3 -out example.com.key 2048
Generating RSA private key, 2048 bit long modulus
....+++
..........................................................................................................................+++
e is 65537 (0x10001)
Enter pass phrase for example.com.key:
Verifying - Enter pass phrase for example.com.key:
%tom
###Nginx config to make Chef servers WebGUI (localhost:4040) and
###REST API (localhost:4000) both available over SSL in the same vhost.
#If your SSL certificate requires a CA Cert bundle, then you may also need to install/symlink a copy of the
#bundle pem in folder /etc/ssl/certs/ and run "c_rehash /etc/ssl/certs/" on the machines that
#need to access these SSL endpoints.
# This is typically needed for RapidSSL/Geotrust issued SSL certificates, YMMV.
#I have these upstreams in the main nginc.conf:
#rest api
upstream chef_webui {