Skip to content

Instantly share code, notes, and snippets.

View abishekmuthian's full-sized avatar

Abishek Muthian abishekmuthian

View GitHub Profile
actuallymentor /
Last active November 18, 2021 12:42
Android Shell Commands (for use with Tasker or adb)
# These commands can all be run as Tasker shell commands, or through adb
# NOTE ON ROOT: I noticed many commands work through the adb shell, but fail in tasker unless using ROOT. If you tasks fail, try enabling root for it
# Enable deep doze
dumpsys deviceidle force-idle
erangaeb / redis-sadd.go
Last active May 17, 2022 09:30
redis SADD with golang
View redis-sadd.go
func sadd(key string, val string) error {
// get conn and put back when exit from method
conn := pool.Get()
defer conn.Close()
_, err := conn.Do("SADD", key, val)
if err != nil {
log.Printf("ERROR: fail add val %s to set %s, error %s", val, key, err.Error())
return err
mrispoli24 /
Created October 15, 2018 18:41
Setting up Heroku and Cloudflare (the right way)

Setting up Heroku and Cloudflare (the right way)

The following outlines how to setup Heroku + Cloudflare with a full SSL certificate. What this means is that communication between the browser and the Cloudflare CDN is encrypted as well as communication between Cloudflare and Heroku’s origin server. Follow these steps exactly and the setup is a breeze.

Step 1: Set up domain names in Heroku

First you want to add the root domain and the www domain to heroku. You do this by clicking into your production application, then going to settings and then scrolling down to Domains and certificates.

Here you will add <your_domain>.com and www.<your_domain>.com. This will give you two CNAME records. They will look something like <your_domain> and www.<your_domain>

Step 2: Add CNAME records to Cloudfare.

avishayp / Dockerfile
Created September 25, 2018 19:02
Add non-root user for alpine linux
View Dockerfile
# non root user example for alpine
# usage:
# $ docker build --build-arg "USER=someuser" --tag test .
# $ docker run --rm test
FROM alpine
ARG USER=default
javascriptlove / cleanup.js
Created May 22, 2018 13:07
Remove orphan GridFS chunks from MongoDB
View cleanup.js
var i = 0;
var orphans = 0;
db.fs.chunks.find({}, { files_id: 1 }).forEach(function(chunk) {
if (i % 100 === 0) {
if (!db.fs.files.findOne({ _id: chunk.files_id }, { _id: 1 })) {
print("orphan " + chunk._id);
db.fs.chunks.remove({ _id: chunk._id });
asukakenji /
Last active September 29, 2023 07:21
Go (Golang) GOOS and GOARCH
mrnugget / go-sqlite3_database_is_locked.go
Created March 3, 2016 05:58
Program that tests the concurrency issues with go-sqlite3. This will create two tables: `products` and `users`. One goroutine will repeatedly read from the `products` table in N fresh goroutines. At the same time ONE goroutine writes to the other table.
View go-sqlite3_database_is_locked.go
package main
import (
kylefrost /
Last active July 31, 2021 19:24
How-To: Tweet All Commit Messages

Creating the post-commit file

Note: If you want to use your personal Twitter account to post commits, go to Step 2

  1. Create a new Twitter account for your commit messages. Example
  2. Go to and Sign In with your Twitter account you are posting commit messages to.
  3. Hover over your username in the top-right corner after signing in and select "My Applications"
  4. Create a new application
  5. The name, description, and site can all be whatever you want, but leave Callback URL empty
  6. Under "Application Settings" click "modify app permissions" next to "Access level"
jboner / latency.txt
Last active September 29, 2023 13:38
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers (~2012)
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD