Skip to content

Instantly share code, notes, and snippets.

View pronskiy's full-sized avatar
🐘
🇺🇦

Roman Pronskiy pronskiy

🐘
🇺🇦
View GitHub Profile
@mohamedmansour
mohamedmansour / gist:803631
Created January 31, 2011 04:11
Get and Set localStorage from Content Script
// Content Script to save data.
chrome.extension.sendRequest({storage: 'foo', value: 'bar'});
// Content Script to get data.
chrome.extension.sendRequest({storage: 'foo'}, function(response) {
console.log('foo => ' + response.storage);
});
// Background Page
@phpdude
phpdude / nginx.conf
Last active February 28, 2024 04:36
Nginx image filter + caching of results.
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@ziadoz
ziadoz / awesome-php.md
Last active April 17, 2024 21:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@deltheil
deltheil / nginx.conf
Created June 4, 2012 07:57
Hide sensitive GET parameters within nginx access logs thanks to the Lua module
http {
log_format filt '$remote_addr - $remote_user [$time_local] "$_request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
server {
location /login {
# `set` is provided by the Rewrite module
set $filter "password|secret";
@Mithrandir0x
Mithrandir0x / gist:3639232
Created September 5, 2012 16:15
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@n3b
n3b / install_mcrypt.sh
Created November 12, 2012 16:21 — forked from istepanov/install_mcrypt.sh
Compile and install mcrypt.so PHP extension for Mac OS X 10.8 Mountain Lion
#!/usr/bin/sh
# Scipt for installing mcrypt.so extension for PHP 5.3.13 (default PHP for OS X 10.8 Mountain Lion)
mkdir /tmp/mcrypt
cd /tmp/mcrypt
curl --location --progress-bar http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download | tar -zx
curl --location --progress-bar http://us.php.net/get/php-5.3.13.tar.gz/from/nl.php.net/mirror | tar -zx
@bag-man
bag-man / cpu.js
Last active March 29, 2024 12:01
How to calculate the current CPU load with Node.js; without using any external modules or OS specific calls.
var os = require("os");
//Create function to get CPU information
function cpuAverage() {
//Initialise sum of idle and time of cores and fetch CPU info
var totalIdle = 0, totalTick = 0;
var cpus = os.cpus();
//Loop through CPU cores
@arunoda
arunoda / gist:7790979
Last active February 16, 2024 14:05
Installing SSHPass

Installing SSHPASS

SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.

Installing on Ubuntu

apt-get install sshpass

Installing on OS X

@andreazevedo
andreazevedo / install_mono.sh
Last active November 12, 2021 02:51
Install mono on centOS 6.x
$ yum install bison gettext glib2 freetype fontconfig libpng libpng-devel libX11 libX11-devel glib2-devel libgdi* libexif glibc-devel urw-fonts java unzip gcc gcc-c++ automake autoconf libtool make bzip2 wget
$ cd /usr/local/src
$ wget http://download.mono-project.com/sources/mono/mono-3.2.8.tar.bz2
$ tar jxf mono-3.2.8.tar.bz2
$ cd mono-3.2.8