Skip to content

Instantly share code, notes, and snippets.

@joni
joni / toUTF8Array.js
Last active June 30, 2023 04:02
toUTF8Array: Javascript function for encoding a string in UTF8.
function toUTF8Array(str) {
var utf8 = [];
for (var i=0; i < str.length; i++) {
var charcode = str.charCodeAt(i);
if (charcode < 0x80) utf8.push(charcode);
else if (charcode < 0x800) {
utf8.push(0xc0 | (charcode >> 6),
0x80 | (charcode & 0x3f));
}
else if (charcode < 0xd800 || charcode >= 0xe000) {
@numberoverzero
numberoverzero / Small timer.py
Last active December 20, 2016 19:47
Updated noop callback to correctly handle multiple args.
import time
def timer():
start = time.time()
return lambda: time.time() - start
def timed(callback=None):
if callback is None:
callback = lambda *a, **kw: None
def wrapper(func):
def wrapped_call(*args, **kwargs):
@nicolashery
nicolashery / solarized-dark.css
Last active March 25, 2022 08:38 — forked from scotu/solarized.css
Solarized theme stylesheets for Jekyll and Pygments
/* Solarized Dark
For use with Jekyll and Pygments
http://ethanschoonover.com/solarized
SOLARIZED HEX ROLE
--------- -------- ------------------------------------------
base03 #002b36 background
base01 #586e75 comments / secondary content
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 7, 2024 09:29
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@numberoverzero
numberoverzero / Preferences.sublime-settings
Last active January 31, 2016 08:01
sublime text user settings
{
"always_show_minimap_viewport": true,
"auto_complete_delay": 200,
"bold_folder_labels": true,
"caret_extra_width": 1,
"color_scheme": "Packages/Bubububububad and Boneyfied Color Schemes/Boneyfied.tmTheme",
"draw_minimap_border": true,
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
@numberoverzero
numberoverzero / gist:a2bb50011c64e20823c0
Last active February 15, 2016 23:43
Installed sublime packages
git
gitgutter
package control
sidebarenhancements
sublimelinter
sublimelinter-flake8
sublimelinter-jshint
theme - sodareloaded
sass
@numberoverzero
numberoverzero / CleanTwitchHomepage.user.js
Last active September 21, 2016 10:00
Clean up the twitch homepage to get to the shit I care about faster
// ==UserScript==
// @name CleanTwitchHomepage
// @namespace https://numberoverzero.com
// @description clean up the twitch homepage to get to the shit I care about
// @include http://www.twitch.tv/
// @include https://www.twitch.tv/
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @version 2
// @grant GM_addStyle
@sheharyarn
sheharyarn / nginx.overrides
Created June 27, 2015 20:31
Restart / Reload Nginx without Entering Sudo Password
# Enter this command to create a sudoers override/include file:
# sudo visudo -f /etc/sudoers.d/nginx.overrides
# (Make sure you actually have this in your /etc/sudoers - Run `sudo visudo` to check)
# #includedir /etc/sudoers.d
# This file assumes your deployment user is `deploy`
# Nginx Commands
Cmnd_Alias NGINX_RESTART = /usr/sbin/service nginx restart
@dominikwilkowski
dominikwilkowski / README.md
Last active October 19, 2020 03:52
Ubuntu setup with NGINX http/2 and letsencrypt

Intro

This is a basic collection of things I do when setting up a new headless ubuntu machine as a webserver. Following the steps below should give you a reasonable secure server with HTTP/2 support (including ALPN in chrome) and the fast NGINX server. I am happy to add things so leave a comment.

Basics

After creating the server (droplet on DigitalOcean) log in with

@numberoverzero
numberoverzero / appendix.rst
Last active November 11, 2021 23:41
semver appendix A

Appendix: Backwards Compatible Bug Fixes

The last point of Semantic Versioning 2.0.0__ has caused much debate around what constitutes a breaking change__. There's no way to strictly define breaking without reducing it to uselessness. Instead, the following tests are applied to determining if a bug fix is backwards compatible. If either of the following holds, fixing the bug is backwards incompatible:

  1. A reasonable user would not notice the unintended behavior; even if it is not covered by, or is directly