Skip to content

Instantly share code, notes, and snippets.

@wookietreiber
wookietreiber / git-hook-shellcheck.sh
Last active April 27, 2021 05:15
git pre-commit hook to check shell scripts with shellcheck
#!/usr/bin/env bash
set -efu -o pipefail
# returns staged files
function staged.files {
if git rev-parse --verify HEAD &> /dev/null
then
against=HEAD
else
@TheHippo
TheHippo / Makefile
Created March 31, 2016 22:32
Golang Makefile example
OUT := binariy-name
PKG := gitlab.com/group/project
VERSION := $(shell git describe --always --long --dirty)
PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/)
all: run
server:
go build -i -v -o ${OUT} -ldflags="-X main.version=${VERSION}" ${PKG}
# Luxafor via Python
# Dave Irvine www.daveirvine.me @dave_irvine
# Get PyUSB from:
# http://walac.github.io/pyusb/
#!/usr/bin/python
import usb.core
import usb.util
@xem
xem / codegolf.md
Last active March 22, 2024 15:41
JS code golfing

codegolf JS

Mini projects by Maxime Euzière (xem), subzey, Martin Kleppe (aemkei), Mathieu Henri (p01), Litterallylara, Tommy Hodgins (innovati), Veu(beke), Anders Kaare, Keith Clark, Addy Osmani, bburky, rlauck, cmoreau, maettig, thiemowmde, ilesinge, adlq, solinca, xen_the,...

(For more info and other projects, visit http://xem.github.io)

(Official Slack room: http://jsgolf.club / join us on http://register.jsgolf.club)

@archon810
archon810 / BuildConfig.java
Last active September 28, 2022 15:17
Fake Virus Shield AV
package com.deviant.security.shield;
public final class BuildConfig {
public static final String BUILD_TYPE = "debug";
public static final boolean DEBUG;
public static final String FLAVOR = "";
public static final String PACKAGE_NAME = "com.deviant.security.shield";
public static final int VERSION_CODE = 4;
public static final String VERSION_NAME = "2.2";
@jdiaz5513
jdiaz5513 / ascii_arty.py
Last active December 30, 2023 02:32
Console ASCII Art Generator
#! /usr/bin/env python2
# Requires: PIL, colormath
#
# Improved algorithm now automatically crops the image and uses much
# better color matching
from PIL import Image, ImageChops
from colormath.color_conversions import convert_color
from colormath.color_objects import LabColor
from colormath.color_objects import sRGBColor as RGBColor
@dotike
dotike / try_or_die.sh
Last active July 18, 2023 20:23
3 finger claw technique for POSIX shell programming. Three one-line functions which greatly enhance shell programming, enabling reliable UNIX-style programming in an extremely concise fashion.
#!/bin/sh
##############################################################################
# This code known is distributed under the following terms:
#
# Copyright (c) 2013 Isaac (.ike) Levy <ike@blackskyresearch.net>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@todgru
todgru / rebase.md
Last active September 26, 2023 00:25
git rebase interactive remove commit

#git rebase -i <sha>

List of commits from git log

F--E--D--C--B--A

Lets say you want to remove commit D from the commits.

git rebase -i E

@lwille
lwille / StIdNr-Validierung.js
Created February 15, 2013 13:45
Validierung der deutschen Steueridentifikationsnummer
number = '9132456781'.split('');
validation = number.pop();
var n = 11,
m = 10,
product = m,
sum = 0;
console.log("StIdNr: %s, validation: %s", number.join(''),validation);
for (var i in number) {
var c = parseInt(number[i], m);