Skip to content

Instantly share code, notes, and snippets.

Avatar

Denton Liu Denton-L

View GitHub Profile
View clear-stale.sh
#!/bin/sh
git ls-remote --heads "$1" |
cut -f2 |
sed -e 's|refs/heads/||' |
while read b
do
if [ `git rev-list --count "$2".."$1/$b"` -eq -0 -a "$b" != "$2" ]
then
echo $b
View do-remote-lock
#!/bin/sh
IP_HEAD=`ip route | perl -ne '/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.)\d{1,3}\/\d{1,2} dev/ && print $1'`
for i in `seq 0 255`
do
curl -X POST $IP_HEAD$i:1337/lock --connect-timeout 1 > /dev/null 2>&1 &
done
View MarkArchiveRead.gs
function main() {
var threads = GmailApp.search('label:unread -label:inbox');
for (var i = 0; i < threads.length; i++) {
threads[i].markRead();
}
Logger.log("%s threads were marked read.", threads.length.toString());
}
@Denton-L
Denton-L / webhook.py
Last active Aug 15, 2017
A quick and dirty server. You can set up a webhook to point to it and, whenever the endpoint is hit, it will automatically git pull.
View webhook.py
#!/usr/bin/env python3
import http.server
import socketserver
import subprocess
GIT_DIRECTORY='<directory>'
ENDPOINT='/<endpoint>'
PORT=0
View mthesaur.txt
a cappella,abbandono,accrescendo,affettuoso,agilmente,agitato,amabile,amoroso,appassionatamente,appassionato,brillante,capriccioso,con affetto,con agilita,con agitazione,con amore,crescendo,decrescendo,diminuendo,dolce,forte,fortissimo,lamentabile,leggiero,morendo,parlando,pianissimo,piano,pizzicato,scherzando,scherzoso,sordo,sotto voce,spiccato,staccato,stretto,tremolando,tremoloso,trillando
a la mode,advanced,avant-garde,chic,contemporary,dashing,exclusive,far out,fashionable,fashionably,forward-looking,in,in the mode,mod,modern,modernistic,modernized,modish,modishly,newfashioned,now,present-day,present-time,progressive,soigne,soignee,streamlined,stylish,stylishly,tony,trendy,twentieth-century,ultra-ultra,ultramodern,up-to-date,up-to-datish,up-to-the-minute,vogue,voguish,way out
a priori,a fortiori,a posteriori,analytic,back,backward,categorical,conditional,deducible,deductive,derivable,dialectic,discursive,dogmatic,early,enthymematic,epagogic,ex post facto,hypothetical,inductive,inferential,into the past,m
View pong.c
#define PADDLEHEIGHT 5
#define BALLSIZE 3
short *PA = 0x8000;
short *PB = 0x8001;
short *DDRA = 0x8002;
short *DDRB = 0x8003;
short pbbuff;
short paddle;
@Denton-L
Denton-L / sieve.c
Last active Aug 29, 2015
Generates all prime numbers less than 1000000 using the Sieve of Eratosthenes.
View sieve.c
#include <stdlib.h>
/*
* returns an int[] where int[0] is the length of the array
* and subsequent elements are the primes themselves.
*/
int* findprimes(int range) {
int prime = 2;
int i;
int *notprime = calloc(sizeof(notprime), range);
@Denton-L
Denton-L / EulersMethod.java
Last active Aug 29, 2015
Euler's Method for Estimating Differential Equations
View EulersMethod.java
public class EulersMethod {
private double x1;
private double y1;
private double dx;
private double x2;
private Differential dydx;
public interface Differential {
double equation(double x, double y);
@Denton-L
Denton-L / Encrypter.c
Last active Aug 29, 2015
A Simple XOR Cipher
View Encrypter.c
#include <stdio.h>
int main(int argc, char *argv[]) {
FILE *input, *key, *output;
int inchar, keychar;
if (argc != 4) {
printf("Usage: \"%s [input] [key] [output]\"", argv[0]);
return -1;
}