Skip to content

Instantly share code, notes, and snippets.

@anaclumos
anaclumos / RH.java
Last active July 31, 2022 19:47
Silicon Valley S06 E04 Richard Hendricks Sorted List Brute Force Search Code
(R. Hendricks 112) int index = 0;
(R. Hendricks 113) while (!element.equals(sortedList.get(index))
(R. Hendricks 114) && sortedList.size() > ++index);
(R. Hendricks 115) return index < sortedList.size() ? index : -1;
@multun
multun / message_json_parser.py
Created December 26, 2018 22:51
Pretty-print a facebook message.json, fixing up broken encoding
import sys
import json
from datetime import datetime
def fixup_str(text):
return text.encode('latin1').decode('utf8')
def fixup_list(l):
@mbrehin
mbrehin / prosemirror.js
Created January 26, 2018 08:59
Prosemirror example: replacing form textareas
import { EditorState } from 'prosemirror-state'
import { EditorView } from 'prosemirror-view'
import {
defaultMarkdownParser,
defaultMarkdownSerializer,
schema,
} from 'prosemirror-markdown'
import { exampleSetup } from 'prosemirror-example-setup'
import 'prosemirror-view/style/prosemirror.css'
Are you having a good day today?
Be gentle with yourself today.
Breakfast and lunch are as important as dinner, so please don't skip them!
Checking privilege...
Congratulate yourself for doing difficult things, even if they might not seem difficult to others.
Do you have a glass of water nearby? Time for a sip!
Don't be afraid to offer hugs. Someone probably needs them.
Don't compare yourself to others, they are not you! You are unique!
Don't forget to eat breakfast! It's important fuel for every adventure.
Go get a drink of water. Stay hydrated!
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active April 25, 2024 14:59
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@petrbel
petrbel / .travis.yml
Last active October 26, 2019 10:29 — forked from iedemam/gist:9830045
Travis-CI submodules
# Use https (public access) instead of git for git-submodules. This modifies only Travis-CI behavior!
# disable the default submodule logic
git:
submodules: false
# use sed to replace the SSH URL with the public URL, then init and update submodules
before_install:
- sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules
- git submodule update --init --recursive
@Ajnasz
Ajnasz / noemoji.pl
Created October 14, 2014 11:53
# Replace annoying emojis. You can see them on slack, for example.
# noemoji.pl
#
# Replace annoying emojis. You can see them on slack, for example.
use strict;
use vars qw($VERSION %IRSSI);
use Irssi;
$VERSION = '1.0';
@alikins
alikins / .gitattributes
Created October 7, 2014 14:02
po/pot file attributes for textconf and diff (ie, make git diff on gettext files less useless)
*.pot diff=msgcat
*.po diff=msgcat
@apk
apk / websock.sh
Created April 18, 2012 15:51
A web socket server as a bash script.
#!/bin/bash
# WebSocket shell, start & browse to http://<Host>:6655/
# Requires bash 4.x, openssl.
# Author: rootshell@corelogics.de (which isn't me, apk)
coproc d { nc -l -p 6656 -q 0; }
nc -l -p 6655 -q 1 > /dev/null <<-ENDOFPAGE
HTTP/1.1 200 OK
<html><head><script language="javascript">
var url = location.hostname + ':' + (parseInt(location.port) + 1);
@febuiles
febuiles / songs.md
Last active July 1, 2022 03:45
Fetching lyrics in Unix

Fetching lyrics in the command line

Objective: Print the lyrics for the current playing song.

How: We'll create a small bash script to do the fetching for us (using curl) and then we'll display it either in the terminal or in our $EDITOR

Get the current song

First we'll need to get the name of the current song and its artist: