Skip to content

Instantly share code, notes, and snippets.

View amanjeev's full-sized avatar
🦀
#![allow(me_to_explain)]

Amanjeev Sethi amanjeev

🦀
#![allow(me_to_explain)]
View GitHub Profile
@NoraCodes
NoraCodes / amt2config.sh
Last active July 28, 2021 19:42
Apple Magic Touchpad 2 configuration script
#!/usr/bin/env bash
# XInput/Synclient settings for Apple Magic Touchpad 2
# AGPL v3.0 or greater at your option
# (C) Leonora Tindall 2021
# Based on a Reddit post by /u/fr3lld
# and a very helpful AskUbuntu response by Jamie Scott
# Place this somewhere, set it as executable, and place the filename
# in in ~/.xinitrc
set -e
@m-radzikowski
m-radzikowski / script-template.sh
Last active November 15, 2024 11:25
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@tgs
tgs / logiq.py
Last active May 1, 2019 21:19
Prototype Python library for making error messages that explain complicated conditions
# This is a work-for-hire for the Government of the United States, so it is not
# subject to copyright protection.
"""
logiq - A way to build complex conditions and evaluate them against the world.
The goal is to make the conditions easy to construct, and give them useful and
concise error messages as well.
These are some requirement nodes:
@DavidBuchanan314
DavidBuchanan314 / cursed_mandelbrot.c
Last active June 28, 2023 15:12
Compile-time mandelbrot in pure C. Outputs a PGM image file to stdout. Output can be seen at https://twitter.com/David3141593/status/1062468528115200001
#include <stdio.h>
#define SQ(x) (x)*(x)
#define M0(x,y) SQ(x)+SQ(y)<4?0:0xe0
#define M1(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M0(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0)):0xc0
#define M2(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M1(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0xa0
#define M3(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M2(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x80
#define M4(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M3(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x60
#define M5(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M4(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x40
@olix0r
olix0r / thriftcrash.sh
Created July 27, 2017 18:35
Kill your thrift server with this handy dandy command
#!/bin/sh
set -e
echo -n -e \\x00\\x00\\x00\\x08\\x4e\\x49\\x5f\\x50\\x49\\x4e\\x47\\x00 | nc $@
@getify
getify / gist:7ae82fdc2e86bf66bcba
Last active March 27, 2022 19:50
List of ES6 books either out or in progress...
@elucify
elucify / README.md
Last active May 13, 2020 17:40
ClinVar sample README.md

ClinVar

This directory contains:

  • ClinVar (http://www.ncbi.nlm.nih.gov/clinvar/) dataset reports, and ClinVar development documents
  • documents related to the NCBI collaboration with ClinGen (http://www.clinicalgenome.org/)
  • ftp://ftp.ncbi.nih.gov/pub/clinvar/ClinGen/ExpertPanelRequestForm.docx - how to apply for expert panel status
  • data common to ClinVar and GTR
  • ftp://ftp.ncbi.nlm.nih.gov/pub/GTR/standard_terms - terminology used by both GTR and ClinVar.
@acdha
acdha / postactivate
Created March 12, 2014 21:45
Global virtualenvwrapper hooks which add a project's bin directory to the PATH any time you activate a virtualenv
#!/bin/bash
# This hook is run after every virtualenv is activated.
VIRTUALENV_PROJECT_FILE="$VIRTUAL_ENV/$VIRTUALENVWRAPPER_PROJECT_FILENAME";
if [ -f $VIRTUALENV_PROJECT_FILE ]; then
export VIRTUALENV_PROJECT=$(cat $VIRTUALENV_PROJECT_FILE);
if [ -d "$VIRTUALENV_PROJECT/bin" ]; then
export PATH="$VIRTUALENV_PROJECT/bin":$PATH
fi
@Nagyman
Nagyman / workflows-in-django.md
Last active October 19, 2024 22:03
Workflows in Django

Workflows (States) in Django

I'm going to cover a simple, but effective, utility for managing state and transitions (aka workflow). We often need to store the state (status) of a model and it should only be in one state at a time.

Common Software Uses

  • Publishing (Draft->Approved->Published->Expired->Deleted)
@chengyin
chengyin / linkedout.js
Last active July 11, 2021 15:23
Unsubscribe all LinkedIn email in "one click". For an easier to use version, you can check out the bookmarklet: http://chengyin.github.io/linkedin-unsubscribed/
// 1. Go to page https://www.linkedin.com/settings/email-frequency
// 2. You may need to login
// 3. Open JS console
// ([How to?](http://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers))
// 4. Copy the following code in and execute
// 5. No more emails
//
// Bookmarklet version:
// http://chengyin.github.io/linkedin-unsubscribed/