Skip to content

Instantly share code, notes, and snippets.

@danielchappell
danielchappell / route_hooks.js
Last active February 27, 2023 13:34
Ember.Route hook order
import Ember from 'ember';
// Ember 1.10
export default Ember.Route.extend({
//---fire in order on route enter---
beforeModel(transition) {
//empty by default
@ademar111190
ademar111190 / levenshtein.kt
Last active March 5, 2024 10:53
Levenshtein Distance algorithm implementation using Kotlin
import kotlin.math.min
fun levenshtein(lhs : CharSequence, rhs : CharSequence) : Int {
if(lhs == rhs) { return 0 }
if(lhs.isEmpty()) { return rhs.length }
if(rhs.isEmpty()) { return lhs.length }
val lhsLength = lhs.length + 1
val rhsLength = rhs.length + 1
@zchee
zchee / actionlist.vim
Last active April 19, 2024 13:22
IdeaVim actionlist
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb <A-S-G>
$SelectAll <M-A>
$Undo <M-Z>
@michelsalib
michelsalib / deprecated.ts
Created April 23, 2015 13:17
Typescript @deprecated annotation
class Dog {
@deprecated('Dogs don\'t roar, they talk.')
roar() {
console.log('RRRRR');
}
@deprecated()
smile() {
console.log('smile');
}
@mattcanty
mattcanty / .gitconfig
Last active September 23, 2016 11:23
Git 'Standup' Alias
[alias]
aa = add .
s = status
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -10
co = checkout
cob = checkout -b
ec = config --global -e
up = !git pull --rebase --prune $@ && git submodule update --init --recursive
save = !git add -A && git commit -m 'SAVEPOINT'
undo = reset HEAD~1 --mixed
@celeryclub
celeryclub / Setting up headless Raspberry Pi OS on macOS.md
Last active May 2, 2024 02:21
Setting up headless Raspberry Pi OS on macOS

Download the latest Raspberry Pi OS Lite image from https://www.raspberrypi.com/software/operating-systems/ (2022-04-04 at the time of this writing).

Insert your microSD card. Use Raspberry Pi Imager to burn the image to your microSD card. Make to select "Set username and password" in the config before starting. Name the user pi and select your own password.

Ensure the disk is mounted again, then enable SSH.

$ touch /Volumes/boot/ssh
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@lpf23
lpf23 / CNTLM Proxy - Centos
Last active May 11, 2022 08:29
Configure CNTLM Proxy on Centos/Ubuntu
1) Download cntlm rpm package from http://sourceforge.net/projects/cntlm/files/cntlm/
2) Login as root
3) Run command:
$ rpm -ivh cntlm-*.rpm
4a) Obtain password hash for the configuration file in step 4b (do not put plaintext password in configuration)
$ cntlm -H -d <domain> -u <username>
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active May 3, 2024 12:32
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@kimus
kimus / cx_oracle.md
Last active April 28, 2024 10:54
Installing python cx_oracle on Ubuntu

First of all, it just seems like doing anything with Oracle is obnoxiously painful for no good reason. It's the nature of the beast I suppose. cx_oracle is a python module that allows you to connect to an Oracle Database and issue queries, inserts, updates..usual jazz.

Linux

Step 1:

sudo apt-get install build-essential unzip python-dev libaio-dev

Step 2. Click here to download the appropriate zip files required for this. You'll need: