Skip to content

Instantly share code, notes, and snippets.

View selfish's full-sized avatar

selfish

View GitHub Profile
@selfish
selfish / update-outdated-brew-casks.sh
Created November 23, 2022 16:30 — forked from christopheranderton/update-outdated-brew-casks.sh
Upgrade outdated brew casks. One liner, and the ”official” way to do it without using different hacks or scripts. However, it does not really replace some scripts out there, as in-app updates is not seen by Homebrew.
# Upgrade / Update outdated casks installed.
# --------------------------------------------------------------------------------
# Looks for outdated casks and installs the the latest version.
# User data (like application preferences) is intact.
# Updated one liner (thanks Henrik242)
# --------------------------------------------------------------------------------
brew upgrade $(brew outdated --cask --greedy --quiet)
@selfish
selfish / helpful-docker-commands.sh
Created January 13, 2020 16:26 — forked from garystafford/helpful-docker-commands.sh
My list of helpful docker commands
###############################################################################
# Helpful Docker commands and code snippets
###############################################################################
### CONTAINERS ###
docker stop $(docker ps -a -q) #stop ALL containers
docker rm -f $(docker ps -a -q) # remove ALL containers
docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter
# exec into container
@selfish
selfish / emojiArray.js
Last active March 19, 2019 16:02
Emoji List Javascript
// All Emoji v12
var emoji = ["😀","😃","😄","😁","😆","😅","🤣","😂","🙂","🙃","😉","😊","😇","🥰","😍","🤩","😘","😗","☺","😚","😙","😋","😛","😜","🤪","😝","🤑","🤗","🤭","🤫","🤔","🤐","🤨","😐","😑","😶","😏","😒","🙄","😬","🤥","😌","😔","😪","🤤","😴","😷","🤒","🤕","🤢","🤮","🤧","🥵","🥶","🥴","😵","🤯","🤠","🥳","😎","🤓","🧐","😕","😟","🙁","☹","😮","😯","😲","😳","🥺","😦","😧","😨","😰","😥","😢","😭","😱","😖","😣","😞","😓","😩","😫","🥱","😤","😡","😠","🤬","😈","👿","💀","☠","💩","🤡","👹","👺","👻","👽","👾","🤖","😺","😸","😹","😻","😼","😽","🙀","😿","😾","🙈","🙉","🙊","💋","💌","💘","💝","💖","💗","💓","💞","💕","💟","❣","💔","❤","🧡","💛","💚","💙","💜","🤎","🖤","🤍","💯","💢","💥","💫","💦","💨","🕳","💣","💬","👁️‍🗨️","🗨","🗯","💭","💤","👋","🤚","🖐","✋","🖖","👌","🤏","✌","🤞","🤟","🤘","🤙","👈","👉","👆","🖕","👇","☝","👍","👎","✊","👊","🤛","🤜","👏","🙌","👐","🤲","🤝","🙏","✍","💅","🤳","💪","🦾","🦿","🦵","🦶","👂","🦻","👃","🧠","🦷","🦴","👀","👁","👅","👄","👶","🧒","👦","👧","🧑","👱","👨","🧔","👱‍♂️","👨‍🦰","👨‍🦱","👨‍🦳","👨‍🦲","👩","👱‍♀️","👩‍🦰","👩‍🦱","👩‍🦳","👩‍🦲","🧓","👴","👵","🙍","🙍‍♂️","🙍‍♀️","🙎","🙎‍♂️","🙎‍♀️","🙅","🙅‍♂️","🙅‍♀️","🙆","🙆‍♂️","🙆‍♀️","💁","💁‍♂️","💁‍♀️","🙋
@selfish
selfish / osx_install.sh
Created December 26, 2018 10:29 — forked from t-io/osx_install.sh
Install most of my Apps with homebrew & cask
#!/bin/sh
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@selfish
selfish / nginx.conf
Last active September 15, 2020 11:16
Ubuntu Reverse Proxy
events {
}
error_log /var/log/nginx/error.log info;
http {
upstream backend {
server api.clashroyale.com;
@selfish
selfish / fizzbuzz.js
Last active January 11, 2018 10:58
FizzBuzz
/**
* FizzBuzz
* Instruction: Write a program that prints the numbers from 1 to 100.
* But for multiples of three print "Fizz" instead of the number and for the
* multiples of five print "Buzz". For numbers which are multiples of both three
* and five print "FizzBuzz".
**/
// Common dynamic implementation, vanilla:
function fizzbuzz(start = 0, end = 100, dict = {3: 'Fizz', 5: 'Buzz'}) {
@selfish
selfish / gpg_git_signing.md
Created December 31, 2017 14:22 — forked from alopresto/gpg_git_signing.md
Steps to enable GPG signing of git commits.

If anyone is interested in setting up their system to automatically (or manually) sign their git commits with their GPG key, here are the steps:

  1. Generate and add your key to GitHub
  2. $ git config --global commit.gpgsign true ([OPTIONAL] every commit will now be signed)
  3. $ git config --global user.signingkey ABCDEF01 (where ABCDEF01 is the fingerprint of the key to use)
  4. $ git config --global alias.logs "log --show-signature" (now available as $ git logs)
  5. $ git config --global alias.cis "commit -S" (optional if global signing is false)
  6. $ echo "Some content" >> example.txt
  7. $ git add example.txt
  8. $ git cis -m "This commit is signed by a GPG key." (regular commit will work if global signing is enabled)
const Long = require('long')
var tagChars = '0289PYLQGRJCUV'
module.exports = {
tag2id: (tag) => {
if (tag === undefined || typeof tag !== 'string') return false
let id = 0
let tagArray = tag.split('')
for (let a = 0; a < tagArray.length; a++) {
@selfish
selfish / rndColor.js
Created July 11, 2016 17:47
Random color code in javascript:
'#'+('00000'+(Math.random()*0xFFFFFF<<0).toString(16)).slice(-6)
@selfish
selfish / md5.js
Last active December 20, 2017 15:04
Simple MD5 hash in your Node.js application. Not recommended for security.
var crypto = require('crypto');
var data = "whatever";
var hashedValue = crypto.createHash('md5').update(data).digest("hex");