Skip to content

Instantly share code, notes, and snippets.

View IsmailM's full-sized avatar
👋
Focusing

Ismail Moghul IsmailM

👋
Focusing
View GitHub Profile
@IsmailM
IsmailM / mycd.sh
Last active September 8, 2015 15:55 — forked from slowkow/mycd.sh
Record folder-specific history in `.dir_bash_history`
function cd_dir_history()
{
OLDPWD="$PWD"
echo "# $(date) $USER -> $@" >> "$HISTFILE"
command cd "$@"
# If this directory is writable then write to directory-based history file
# otherwise write history in the usual home-based history file.
touch "$PWD/.dir_bash_history" 2>/dev/null \
@IsmailM
IsmailM / waitForKeyElements.js
Created January 26, 2016 00:38 — forked from BrockA/waitForKeyElements.js
A utility function, for Greasemonkey scripts, that detects and handles AJAXed content.
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
that detects and handles AJAXed content.
Usage example:
waitForKeyElements (
"div.comments"
, commentCallbackFunction
);
@IsmailM
IsmailM / app.rb
Created March 15, 2016 23:58 — forked from nu7hatch/app.rb
OmniAuth login in popup
require 'rubygems'
require 'sinatra'
require 'omniauth/oauth'
set :sessions, true
set :layout, true
use OmniAuth::Builder do
provider :twitter, 'key', 'secret'
end

Jekyll is a great tool for building static sites, however, I often see many projects that are including a lot of unused CSS. Since Jekyll generates an entire working site in the _site directory, we can use it to run uncss. Below outlines an example project using uncss and a build.js script.

Note: this assumes you have node and npm installed.

Setting up the project

Firstly, let's set up the project.

jekyll new uncss-example && cd uncss-example
@IsmailM
IsmailM / nginx-passenger-ssl.conf
Created May 20, 2016 08:43 — forked from rkjha/nginx-passenger-ssl.conf
Nginx/Passenger config when using SSL with a Ruby/Rails Application.
# for redirecting hhtp traffic to https version of the site
server {
listen 80;
server_name example.com;
return 301 https://$server_name$request_uri;
}
# for redirecting to non-www version of the site
server {
listen 80;
@IsmailM
IsmailM / .Rprofile.r
Created February 9, 2017 14:54 — forked from stephenturner/.Rprofile.r
My .Rprofile
## See http://gettinggeneticsdone.blogspot.com/2013/06/customize-rprofile.html
## Load packages
library(BiocInstaller)
## Don't show those silly significanct stars
options(show.signif.stars=FALSE)
## Do you want to automatically convert strings to factor variables in a data.frame?
## WARNING!!! This makes your code less portable/reproducible.
@IsmailM
IsmailM / gist:a44c186ef245d8c862b305af7444fc2f
Created February 14, 2017 17:16 — forked from brentp/gist:819611
install annovar and use it to annotate a vcf with hg19
wget http://www.openbioinformatics.org/annovar/download/annovar.latest.tar.gz.mirror
tar xzvf annovar.tar.gz
cd annovar
# download databases (goes to UCSC)
./annotate_variation.pl -buildver hg19 -downdb 1000g2010nov humandb
./annotate_variation.pl -buildver hg19 -downdb avsift humandb
./annotate_variation.pl -buildver hg19 -downdb refGene humandb
./annotate_variation.pl -buildver hg19 -downdb mce46way humandb/
./annotate_variation.pl -buildver hg19 -downdb snp131 humandb/
@IsmailM
IsmailM / Open Safari tabs in Google Chrome
Created February 22, 2017 00:29 — forked from martinwinter/Open Safari tabs in Google Chrome
Opens all Safari windows and tabs in Google Chrome.
tell application "Safari"
repeat with theSafariWindow in windows
tell application "Google Chrome" to set theChromeWindow to make new window
repeat with theSafariTab in theSafariWindow's tabs
set theURL to URL of theSafariTab
tell application "Google Chrome"
set theChromeTab to make new tab at end of tabs of theChromeWindow
set URL of theChromeTab to theURL
end tell
end repeat
@IsmailM
IsmailM / tmux-cheatsheet.markdown
Created March 14, 2017 15:35 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@IsmailM
IsmailM / web-servers.md
Created February 3, 2018 19:23 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000