Skip to content

Instantly share code, notes, and snippets.

View ali's full-sized avatar

Ali Ukani ali

View GitHub Profile
@ali
ali / color-conversion-algorithms.js
Created August 16, 2018 13:39 — forked from mjackson/color-conversion-algorithms.js
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
@ali
ali / arch-linux-install
Created April 21, 2018 21:19 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@ali
ali / configureApolloClient.js
Last active June 15, 2020 12:06
network interface for Apollo Client that throws away errors
import ApolloClient, { createNetworkInterface } from 'apollo-client'
const GRAPHQL_ENDPOINT_URL = "…"
const baseNetworkInterface = createNetworkInterface({ uri: GRAPHQL_ENDPOINT_URL })
// Create our own network interface that delegates to Apollo's and ignores errors
const networkInterface = {
query: (...args) => {
return baseNetworkInterface
@ali
ali / Hyper.desktop
Last active June 15, 2020 12:06
/usr/share/applications/Hyper.desktop
[Desktop Entry]
Name=Hyper
Comment=JS/HTML/CSS Terminal
Exec=Hyper
Icon=/usr/share/pixmaps/hyper.png
Terminal=false
Type=Application
Categories=Development;
@ali
ali / 0001-Update-to-Hyper-v0.8.1.patch
Last active June 15, 2020 12:06
diff for Hyper's PKGBUILD in the AUR
From a0495499594e0f49d75ae96a93fbb52efef0becc Mon Sep 17 00:00:00 2001
From: Ali Ukani <[email protected]>
Date: Fri, 7 Oct 2016 18:36:30 -0400
Subject: [PATCH] Update to Hyper v0.8.1
---
PKGBUILD | 31 ++++++++++++-------------------
autohide-menu.patch | 12 ------------
2 files changed, 12 insertions(+), 31 deletions(-)
delete mode 100644 autohide-menu.patch
@ali
ali / eventEmitterMiddleware.js
Created March 1, 2016 18:40
EventEmitterMiddleware allows your Redux actions to emit events to an external event emitter
/**
* A Redux middleware that externally emits events from actions.
* @param {EventEmitter} emitter - emits events
* @returns {Function} a Redux middleware
*/
export const eventEmitterMiddleware = (emitter) => {
if (!emitter) {
throw new Error('Cannot emit events. No EventEmitter provided.')
}
@ali
ali / README.md
Last active June 15, 2020 12:06
large files in iheanyi/bandcamp-dl

I followed the instructions from the first Google result for "big git objects pack size": http://naleid.com/blog/2012/01/17/finding-and-purging-big-files-from-git-history

Summary of how to create bigtosmall.txt:

git rev-list --objects --all | sort -k 2 > allfileshas.txt```
git gc && git verify-pack -v .git/objects/pack/pack-*.idx | egrep "^\w+ blob\W+[0-9]+ [0-9]+ [0-9]+$" | sort -k 3 -n -r > bigobjects.txt```
for SHA in `cut -f 1 -d\  < bigobjects.txt`; do
echo $(grep $SHA bigobjects.txt) $(grep $SHA allfileshas.txt) | awk '{print $1,$3,$7}' >> bigtosmall.txt
done;
@ali
ali / gist:aeee4516907327e3f96c
Created April 18, 2015 01:45
ssh-copy-id fails if the remote user's default shell is fish
~ $ ssh-copy-id -i ~/.ssh/id_rsa -o PubkeyAuthentication=no ali:@orchid.local
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Password:
fish: Expected a command name, got token of type 'Run job in background'. Did you mean 'COMMAND; and COMMAND'? See the help section for the 'and' builtin command by typing 'help and'.
Standard input: mkdir -p .ssh && cat >> .ssh/authorized_keys || exit 1 ;
@ali
ali / gist:a0879c67f13403be08f9
Created November 14, 2014 07:29
base16-ocean.dark.256.itermcolors.js
term_.prefs_.set('background-color', '#2b303b');
term_.prefs_.set('foreground-color', '#c0c5ce');
term_.prefs_.set('cursor-color', '#c0c5ce')
term_.prefs_.set('color-palette-overrides', ["#2b303b","#bf616a","#a3be8c","#ebcb8b","#8fa1b3","#b48ead","#96b5b4","#c0c5ce","#65737e","#bf616a","#a3be8c","#ebcb8b","#8fa1b3","#b48ead","#96b5b4","#eff1f5"]);
@ali
ali / hterm-colors.js
Created December 27, 2013 03:09
My Chrome Secure Shell (hterm) colors. Hex values stolen from @w0ng's vim-hybrid .Xresources
term_.prefs_.set('background-color', '#1D1F21');
term_.prefs_.set('foreground-color', '#C5C8C6');
term_.prefs_.set('color-palette-overrides', [
'#282A2E', '#A54242', '#8C9440', '#DE935F',
'#5F819D', '#85678F', '#5E8D87', '#707880',
'#373B41', '#CC6666', '#B5BD68', '#F0C674',
'#81A2BE', '#B294BB', '#8ABEB7', '#C5C8C6'
]);