Skip to content

Instantly share code, notes, and snippets.

@fudanchii
fudanchii / dpss
Last active November 21, 2018 11:14
docker related scripts
#!/usr/bin/env bash
set -e
# change this to your seeds directory
base=$HOME/repo/quipper/seeds
startall() {
postgres.sh
mongodb.sh
@fudanchii
fudanchii / Gemfile
Last active March 28, 2019 09:40
rbnacl mem benchmark
source "https://rubygems.org"
gem 'rbnacl'
gem 'allocation_stats'
gem 'benchmark-memory'
#[macro_use]
extern crate lazy_static;
use std::io::prelude::*;
use std::fs::OpenOptions;
use std::path::{Path, PathBuf};
use std::time::Duration;
use std::thread;
lazy_static! {
#! /usr/bin/env bash
exec 3<>/dev/tcp/$1
while read line
do
echo -e "$line" >&3
cat <&3
done < "${1:-/dev/stdin}"
#! /usr/bin/env bash
interim_branch=default
rollgit() {
[[ $# -ne 1 ]] && {
echo 'wrong number of arguments, USAGE:'
printf "\tgit roll <branch>\n"
exit 1
}
alert('yay');
@fudanchii
fudanchii / gist:9649794
Created March 19, 2014 19:48
rusty quine
fn main() {
let text = r##" println!("fn main() {}\n let text = {}{}{}{}{}{}{}{};\n{};\n{}", "{", "r", "#", "#", '"', text, '"', "#", "#", text, "}")"##;
println!("fn main() {}\n let text = {}{}{}{}{}{}{}{};\n{};\n{}", "{", "r", "#", "#", '"', text, '"', "#", "#", text, "}");
}
@fudanchii
fudanchii / store_credits.c
Last active December 27, 2015 20:39
Code golf in C, Go, Python, Ruby [Store Credits problem]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
int do_alloc(char **buffer) {
int cpos = 0;
if (!*buffer) {
*buffer = calloc(2, sizeof(char));
<!doctype html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="/rickshaw/rickshaw.min.css">
<link type="text/css" rel="stylesheet" href="/rspfpm.css">
<script src="/rickshaw/vendor/d3.min.js"></script>
<script src="/rickshaw/vendor/d3.layout.min.js"></script>
<script src="/rickshaw/rickshaw.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</head>
@fudanchii
fudanchii / jsc.c
Last active December 21, 2015 04:18
#include "jsc.h"
#include "main.js"