Skip to content

Instantly share code, notes, and snippets.

View fatso83's full-sized avatar
🐢
Two toddlers. Very little time for OSS after work hours. File a PR!

Carl-Erik Kopseng fatso83

🐢
Two toddlers. Very little time for OSS after work hours. File a PR!
View GitHub Profile
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@lsd
lsd / IdeaVim OS X Key Repeat.markdown
Last active May 3, 2024 07:22
Enable key-repeat for ALL applications or just for IdeaVim/specific JetBrains apps

Upgrading to Lion or Yosemite and WebStorm 9, I noticed key repeat was
turned off for the IdeaVim plugin h j k l keys.

System-wide key repeat

defaults write -g ApplePressAndHoldEnabled -bool false in a terminal will enable
key repeat for every app. This can alternatively be found in the accessibility settings in OS X' preferences.

App specific key repeat

@bulletinmybeard
bulletinmybeard / fix-for-sudo-command-error-unable-to-initialize-pam-no-such-file-or-directory.md
Last active April 8, 2024 08:16
macOS - Fix for sudo command error: "unable to initialize PAM: No such file or directory" (Intel+M1)

In most cases, the sudo command displays the error unable to initialize PAM: No such file or directory mostly appears when the pluggable authentication module file /etc/pam.d/sudo has been edited with a typo or an incorrect PAM module.

Via Single-User-Mode > Terminal

If you have an older Mac, you can boot into single-user mode, which allows you to access the command line mode of macOS directly, bypassing the UI.

  • Press and hold down the COMMAND + S keys until you see commands being executed in the Terminal.

  • Open the sudo file with vi /Volumes/Macintosh\ - Data/etc/pam.d/, fix what's wrong, save and close the file by switching from INSERT to the COMMAND mode with the ESC key, type :wq!, and hit enter.

@tony4d
tony4d / p4merge4git.md
Created August 24, 2012 19:00
Setup p4merge as a visual diff and merge tool for git
@klaaspieter
klaaspieter / ASS.md
Created June 22, 2017 07:59 — forked from anonymous/ASS.md
Acronyms Seriously Suck - Elon Musk

From time to time, Musk will send out an e-mail to the entire company to enforce a new policy or let them know about something that's bothering him. One of the more famous e-mails arrived in May 2010 with the subject line: Acronyms Seriously Suck:

There is a creeping tendency to use made up acronyms at SpaceX. Excessive use of made up acronyms is a significant impediment to communication and keeping communication good as we grow is incredibly important. Individually, a few acronyms here and there may not seem so bad, but if a thousand people are making these up, over time the result will be a huge glossary that we have to issue to new employees. No one can actually remember all these acronyms and people don't want to seem dumb in a meeting, so they just sit there in ignorance. This is particularly tough on new employees.

That needs to stop immediately or I will take drastic action - I have given enough warning over the years. Unless an acronym is approved by me, it should not enter the SpaceX glossary.

@getify
getify / ex1-prototype-style.js
Last active January 7, 2024 11:58
OLOO (objects linked to other objects) pattern explored (with comparison to the prototype style of the same code)
function Foo(who) {
this.me = who;
}
Foo.prototype.identify = function() {
return "I am " + this.me;
};
function Bar(who) {
Foo.call(this,"Bar:" + who);
@juanje
juanje / Description.md
Last active November 30, 2023 19:29
Limit Chrome from eating all the memory and CPU

I was tired of Chrome eating all my laptop resources so I decided to put some limit to it with cgroup.

As I was using Ubuntu 12.04 with support for cgroup, I installed the package cgroup-bin and add the following group to the file /etc/cgconfig.conf:

group browsers {
    cpu {
#       Set the relative share of CPU resources equal to 25%
        cpu.shares = "256";
 }
//
// This program reads a sourcemap from stdin
// and replaces the "mappings" property with
// human readable content. It writes the output
// to stdout.
//
// 1. install the dependencies:
// npm i concat-stream vlq
//
// 2. optional: install jq for pretty printing json
@infinite-system
infinite-system / Kernel.ts
Last active August 25, 2023 15:23
Basic IOC container similar to Inversify
class Mapping {
constructor (public from: ObjectConstructor) {
this.to = from
}
to: ObjectConstructor
scope = 'singleton'
onActivation: (resolved, ...args) => {}
}
export class Kernel {
@kongchen
kongchen / setprop.sh
Last active January 3, 2023 09:29
set properties file value by key via bash shell
#!/bin/bash
############################
#script function
############################
setProperty(){
awk -v pat="^$1=" -v value="$1=$2" '{ if ($0 ~ pat) print value; else print $0; }' $3 > $3.tmp
mv $3.tmp $3
}
############################