Skip to content

Instantly share code, notes, and snippets.

@jonschlinkert
jonschlinkert / markdown-cheatsheet.md
Last active April 23, 2025 17:58
A better markdown cheatsheet.
@justinbowes
justinbowes / compile_time_hash.h
Last active January 2, 2019 13:02
Hash strings at compile time.
#ifndef compile_time_hash_h
#define compile_time_hash_h
// Posted by jbowes. Public domain.
// source: (dead link)
// http://lol.zoy.org/blog/2011/12/20/cpp-constant-string-hash
//
// At higher compiler optimization levels (-O1 and higher on clang/llvm),
// C_HASH("string") should be replaced by a hash of "string" at compile time.
@gotohr
gotohr / gist:7005197
Created October 16, 2013 09:36
declarative function composition - golang
package main
import "fmt"
type F func(i int) int
func (f F) compose(inner F) F {
return func(i int) int { return f(inner(i)) }
}
Installing Arch:
sudo vim /etc/pacman.conf
Update packages list: sudo pacman -Syy
run sudo pacman -Syu before installing any software (to update the repositories first)
* Timing issue:
- Change hardware clock to use UTC time:
sudo timedatectl set-local-rtc 0
@JuanMaRuiz
JuanMaRuiz / Scrollbar.css
Last active August 31, 2019 02:20
Customize the scrollbar of the web like Gmail with only css. [Chrome and Safari]
::-webkit-scrollbar {
background: transparent;
overflow: visible;
width: 17px;
}
::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.2);
border: solid #fff;
}
@wbroek
wbroek / genymotionwithplay.txt
Last active February 13, 2025 09:37
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
@GitTom
GitTom / RedditOAuth.java
Last active June 30, 2019 15:42
Reddit OAuth2 Java sample code (uses Google HTTP and json.org libs)
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONObject;
import org.json.JSONTokener;
import com.google.api.client.extensions.appengine.http.UrlFetchTransport;
import com.google.api.client.http.GenericUrl;
import com.google.api.client.http.HttpContent;
import com.google.api.client.http.HttpRequest;
@walm
walm / 1_server-stats-json.sh
Last active April 22, 2025 18:53
Simple Linux Server stats as JSON
#!/bin/sh
echo -n '{'
# memory as "mem": { "current": 800, "total": 1024, "load", 82 } where amount is in MB and load in %
free -m | awk 'NR==2{printf "\"mem\": { \"current\":%d, \"total\":%d, \"load\": %.2f }", $3,$2,$3*100/$2 }'
echo -n ','
# diska as "disk": { "current": 6, "total": 40, "used": 19 } where amount is in GB and used in %
df -h | awk '$NF=="/"{printf "\"disk\": { \"current\":%d, \"total\":%d, \"used\": %d }", $3,$2,$5}'
@staltz
staltz / introrx.md
Last active May 4, 2025 15:01
The introduction to Reactive Programming you've been missing
@hrj
hrj / warm.sh
Created July 4, 2014 03:26
warm.sh | A red+green tint effect for the entire screen
#!/bin/bash
# Call with a percentage value from 0 to 100
# 0 means only red and green, 50 means half of blue is shown through
# if you don't give any arguments the calibration is cleared
if [[ -z "$1" ]]; then
echo Clearing all calibrations
xcalib -clear
else