Skip to content

Instantly share code, notes, and snippets.

@JBlond
JBlond / bash-colors.md
Last active May 7, 2024 17:55 — forked from iamnewton/bash-colors.md
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
@GianlucaGuarini
GianlucaGuarini / post-merge
Last active August 22, 2023 20:54 — forked from sindresorhus/post-merge
Git hook that gets triggered after any 'git pull' whenever one of the files specified has changed. Useful to update any web application dependency using bower npm or composer
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# forked by Gianluca Guarini
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep -E --quiet "$1" && eval "$2"
}
@locy
locy / ACS712.ino
Created October 17, 2013 10:49
GY-712 電流傳感器, ACS712TELC-20A, ACS712TELC-30A, Arduino and ACS712 sample code
int VQ;
int ACSPin = 0;
void setup() {
Serial.begin(115200);
VQ = determineVQ(ACSPin); //Quiscent output voltage - the average voltage ACS712 shows with no load (0 A)
delay(1000);
}
void loop() {
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/Xlocale.h>
#define WINDOW_WIDTH 520
@sgmurphy
sgmurphy / url_slug.js
Created July 12, 2012 02:05
URL Slugs in Javascript (with UTF-8 and Transliteration Support)
/**
* Create a web friendly URL slug from a string.
*
* Requires XRegExp (http://xregexp.com) with unicode add-ons for UTF-8 support.
*
* Although supported, transliteration is discouraged because
* 1) most web browsers support UTF-8 characters in URLs
* 2) transliteration causes a loss of information
*
* @author Sean Murphy <sean@iamseanmurphy.com>