Skip to content

Instantly share code, notes, and snippets.

View abishekmuthian's full-sized avatar
💭
@Abishek_Muthian

Abishek Muthian abishekmuthian

💭
@Abishek_Muthian
View GitHub Profile
@javascriptlove
javascriptlove / cleanup.js
Created May 22, 2018 13:07
Remove orphan GridFS chunks from MongoDB
var i = 0;
var orphans = 0;
db.fs.chunks.find({}, { files_id: 1 }).forEach(function(chunk) {
i++;
if (i % 100 === 0) {
print(i);
}
if (!db.fs.files.findOne({ _id: chunk.files_id }, { _id: 1 })) {
print("orphan " + chunk._id);
db.fs.chunks.remove({ _id: chunk._id });
@kylejfrost
kylejfrost / HOWTO.md
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 http://dev.twitter.com 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"
@erangaeb
erangaeb / redis-sadd.go
Last active May 17, 2022 09:30
redis SADD with golang
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
}
@mrnugget
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.
package main
import (
"database/sql"
"fmt"
"log"
"math/rand"
"sync"
"time"
@rashid327
rashid327 / states-of-india
Last active June 19, 2025 08:33
Indian States dropdown HTML
<!-- States of India -->
<select>
<option value="AP">Andhra Pradesh</option>
<option value="AR">Arunachal Pradesh</option>
<option value="AS">Assam</option>
<option value="BR">Bihar</option>
<option value="CT">Chhattisgarh</option>
<option value="GA">Gujarat</option>
<option value="HR">Haryana</option>
@actuallymentor
actuallymentor / commands.sh
Last active December 28, 2025 03:35
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
##
## SETTING THINGS
# Enable deep doze
dumpsys deviceidle force-idle
@avishayp
avishayp / Dockerfile
Created September 25, 2018 19:02
Add non-root user for alpine linux
# non root user example for alpine
#
# usage:
# $ docker build --build-arg "USER=someuser" --tag test .
# $ docker run --rm test
FROM alpine
ARG USER=default
ENV HOME /home/$USER
@HananoshikaYomaru
HananoshikaYomaru / fix.css
Last active January 27, 2026 18:31
life calendar in obsidian using dataview js
/* wide */
.wide .markdown-preview-sizer {
max-width: unset !important;
}
.life-calendar p a.internal-link {
display: inline-block;
}
@lupyuen
lupyuen / zig-termux.md
Last active February 28, 2026 17:34
Install Zig in Termux Android

Install Zig in Termux Android

Here are the steps to install Zig Compiler in Termux Android...

Install Termux from F-Droid, because the Google Play version is outdated...

Launch Termux on Android and enter...

@mrispoli24
mrispoli24 / setting-up-heroku-and-cloudflare.md
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>.com.herokudns.com and www.<your_domain>.com.herokudns.com.

Step 2: Add CNAME records to Cloudfare.