This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Terminal color definitions | |
class fg: | |
BLACK = '\033[30m' | |
RED = '\033[31m' | |
GREEN = '\033[32m' | |
YELLOW = '\033[33m' | |
BLUE = '\033[34m' | |
MAGENTA = '\033[35m' | |
CYAN = '\033[36m' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Fast functions for working with binary data | |
return { | |
decode_uint8 = function(str, ofs) | |
ofs = ofs or 0 | |
return string.byte(str, ofs + 1) | |
end, | |
decode_uint16 = function(str, ofs) | |
ofs = ofs or 0 | |
local a, b = string.byte(str, ofs + 1, ofs + 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor; | |
using UnityEditor.UIElements; | |
using UnityEditor.Experimental.GraphView; | |
using UnityEngine.UIElements; | |
using GraphProcessor; | |
[NodeCustomEditor(typeof(MapOutputNode))] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in case branchA is not our current branch | |
git checkout branchA | |
# make merge commit but without conflicts!! | |
# the contents of 'ours' will be discarded later | |
git merge -s ours branchB | |
# make temporary branch to merged commit | |
git branch branchTEMP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SRCS=$(wildcard *.c) | |
OUTDIR=dist | |
TARGET=$(OUTDIR)/app | |
all: $(TARGET) $(TARGET).exe | |
clean: | |
rm -f $(OUTDIR) | |
$(OUTDIR): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream foo { | |
server foo-container:80; | |
} | |
upstream bar { | |
server bar-container:3000; | |
} | |
map $subdomain $container { | |
foo foo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Runtime type checking concept | |
from functools import wraps | |
def signature(*types): | |
def decorator(func): | |
@wraps(func) | |
def wrapper(*args, **kwargs): | |
for i, t in enumerate(types): | |
if i >= len(args): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import pprint | |
import sys | |
# 7 Prisoners, 1 designated counter | |
prisoners = [ | |
{"seen": False, "is_counter": False, "messaged": False}, | |
{"seen": False, "is_counter": False, "messaged": False}, | |
{"seen": False, "is_counter": False, "messaged": False}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET FOREIGN_KEY_CHECKS=0; | |
truncate table `auth_user_user_permissions`; | |
truncate table `auth_permission`; | |
truncate table `django_content_type`; | |
SET FOREIGN_KEY_CHECKS=1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Returns "*" if the current git branch is dirty. | |
_parse_git_dirty() | |
{ | |
[[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]] && echo "*" | |
} | |
# Get the current git branch name (if available) | |
_git_prompt() | |
{ | |
local ref=$(git symbolic-ref HEAD 2>/dev/null | cut -d'/' -f3) |
NewerOlder