Skip to content

Instantly share code, notes, and snippets.

View mrichie's full-sized avatar

Richie Min mrichie

View GitHub Profile
#include <EEPROM.h>
// Absolute min and max eeprom addresses. Actual values are hardware-dependent.
// These values can be changed e.g. to protect eeprom cells outside this range.
const int EEPROM_MIN_ADDR = 0;
const int EEPROM_MAX_ADDR = 511;
// Returns true if the address is between the
// minimum and maximum allowed values, false otherwise.
//
// This function is used by the other, higher-level functions
@haf
haf / LICENSE
Last active February 14, 2024 11:15
Setting up a digitalocean proxy
https://www.gnu.org/licenses/gpl-3.0.en.html
GNU GENERAL PUBLIC LICENSE v3
@raecoo
raecoo / awk-example.sh
Last active September 21, 2023 07:12
awk/grep commands for Rails log analysis
# Access number
cat production.log | grep "^Processing" | wc | awk '{print $1}'
# Each IP access number
cat production.log | grep “^Processing” | awk ‘{print $4}’ | uniq -c
# Independent IP number
cat production.log | grep "^Processing" | awk '{print $4}' | uniq | wc | awk '{print $1}'
cat production.log | grep “^Processing” | awk ‘{print $4}’ | uniq | wc -l
@mhartington
mhartington / CustomTheme
Last active December 8, 2018 20:35
If you want to make a custom theme for ionic, and are using scss, this is a base to get you started
//Custom Theme test
// Colors
// -------------------------------
$custom: #057b6c !default;
// Buttons
// -------------------------------
$button-custom-bg: $custom !default;
@thoughtpolice
thoughtpolice / gist:5025417
Created February 24, 2013 20:16
Ruby benchmarks
$ rbenv versions
system
1.9.3-p385
* 2.0.0-p0 (set by RBENV_VERSION environment variable)
jruby-1.7.3
$ rbenv shell system
$ rbenv which ruby
/usr/bin/ruby
$ ruby --version
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
@PeterDing
PeterDing / baidu_mp3_album_downloader.py
Last active February 22, 2017 05:12
baidu mp3 专辑下载 python 脚本-------------用法:python baidu_mp3_album_downloader.py url## url 是 http://music.baidu.com/song/23473715http://music.baidu.com/album/783596 -- # 移到仓库 https://github.com/PeterDing/iScript
#!/usr/bin/env python2
# vim: set fileencoding=utf8
import re, sys, os, random, time, json, urllib2, logging, argparse
from mutagen.id3 import ID3,TRCK,TIT2,TALB,TPE1,APIC,TDRC,COMM,TCOM,TCON,TSST,WXXX,TSRC
from HTMLParser import HTMLParser
parser = HTMLParser()
s = u'\x1b[1;%dm%s\x1b[0m' # terminual color template
ua = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36'
@jinroh
jinroh / gist:2730863
Created May 19, 2012 13:31
Iterative Deferred with finish conditions...and timeout
var lookup = function(target) {
var send = function() { /* ... */ },
iterative = new IterativeFind(),
init = new XORSortedPeerArray().relativeNodeID(target),
staled = false;
function map(peer) {
var rpc = new FindNodeRPC(peer, this._target);
send(rpc);
return rpc;
@schlamar
schlamar / processify.py
Last active April 17, 2024 19:19
processify
import os
import sys
import traceback
from functools import wraps
from multiprocessing import Process, Queue
def processify(func):
'''Decorator to run a function as a process.
Be sure that every argument and the return value