Skip to content

Instantly share code, notes, and snippets.

Richard Caceres rchrd2

Block or report user

Report or block rchrd2

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
rchrd2 /
Created Oct 20, 2019
wget example to download the website
wget --no-verbose --mirror --convert-links --directory-prefix=dwebsummit-download --no-host-directories
rsync -vv --recursive --links --perms --checksum --ignore-times --exclude={.dat,dat.json} dwebsummit-download/ dwebsummit-dat/
rchrd2 / extra.plist
Created Jul 3, 2018
electron-packager associate with file type (support drag)
View extra.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
rchrd2 / freeway-2600.asm
Last active Oct 20, 2017
Honking & collision sound are redacted
View freeway-2600.asm
; Disassembly of roms/Freeway (1981) (Activision).a26
; Disassembled Thu Oct 19 22:17:47 2017
; Using DiStella v3.01a
; Command Line: ./binaries/osx/distella -pafs roms/Freeway (1981) (Activision).a26
processor 6502
VSYNC = $00
VBLANK = $01
rchrd2 /
Last active Apr 5, 2018
BitBar + sshuttle
# Easily start/stop sshuttle
# <bitbar.title>sshuttle</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <></>
# <>rchrd2</>
# <bitbar.desc>Easily start/stop a background shhuttle.</bitbar.desc>
# <bitbar.image></bitbar.image>
View .bash_profile
PS1="$ "
alias pserve="python -m SimpleHTTPServer"
# show git branch in prompt
export PS1="(\$(git branch 2>/dev/null | grep '^*' | colrm 1 2))\$ "
source /usr/local/etc/bash_completion.d/git-completion.bash
rchrd2 / php_cache.php
Created Jun 3, 2017
Poor man's php cache. Saves to files. Includes expiry.
View php_cache.php
function add_cache($key, $value, $ttl) {
$dir = __DIR__.'/../cache/';
// Remove slashes for security
$filename = $dir . str_replace('/', '', $key);
// Store expiry in first line
$lines = [(string)(time() + (int)$ttl), $value ];
if (!file_exists($dir)) mkdir($dir, 0755, true);
file_put_contents($filename, implode("\n", $lines));
The idea is to take stdin, and write it to a new unique log file
php myscript.php | newlog filename
import os
import sys
rchrd2 / stdin2www
Last active Jan 7, 2017 — forked from cwarden/
Show stdin in a web browser (for Mac OS X)
View stdin2www
# read from stdin, write to a temp file, open the temp file in a browser, then delete it
tmpfile=$(mktemp).html; cat > $tmpfile; open $tmpfile; #rm $tmpfile
rchrd2 /
Last active Nov 30, 2019
Django object manager with Haversine distance annotation method (aka filter by distance with mysql)
from django.db import models
from with_distance_manager import WithDistanceManager
class Foo(models.Model):
longitude = models.DecimalField(max_digits=19, decimal_places=10, null=True)
latitude = models.DecimalField(max_digits=19, decimal_places=10, null=True)
objects = WithDistanceManager()
rchrd2 / rproxy.conf
Last active Dec 27, 2016
NGINX CLI – how to start nginx as a process
View rproxy.conf
error_log /dev/stderr;
events {}
http {
#access_log /dev/stdout;
access_log /dev/null;
server {
listen 8066;
server_name _;
location / {
You can’t perform that action at this time.