Skip to content

Instantly share code, notes, and snippets.

Avatar
🥝
Food makes me happy

Ninja Chen ninjachen

🥝
Food makes me happy
  • Shanghai, China
View GitHub Profile
@sinclairtarget
sinclairtarget / bernoulli.c
Created August 17, 2018 20:22
Lovelace's Note G Program in C
View bernoulli.c
#include <stdio.h>
/*
* Calculates what Ada Lovelace labeled "B7", which today we would call the 8th
* Bernoulli number.
*/
int main(int argc, char* argv[])
{
// ------------------------------------------------------------------------
// Data
@kmark
kmark / AudioRecordActivity.java
Last active June 23, 2022 09:28
An example of how to read in raw PCM data from Android's AudioRecord API (microphone input, for instance) and output it to a valid WAV file. Tested on API 21/23 on Android and API 23 on Android Wear (modified activity) where AudioRecord is the only available audio recording API. MediaRecorder doesn't work. Compiles against min API 15 and probabl…
View AudioRecordActivity.java
/*
* Copyright 2016 Kevin Mark
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@kristopolous
kristopolous / hn_seach.js
Last active February 5, 2023 18:47
hn job query search
View hn_seach.js
// Usage:
// Copy and paste all of this into a debug console window of the "Who is Hiring?" comment thread
// then use as follows:
//
// query(term | [term, term, ...], term | [term, term, ...], ...)
//
// When arguments are in an array then that means an "or" and when they are seperate that means "and"
//
// Term is of the format:
// ((-)text/RegExp) ( '-' means negation )
@franmontiel
franmontiel / PersistentCookieStore.java
Last active July 28, 2022 01:35
A persistent CookieStore implementation for use in Android with HTTPUrlConnection or OkHttp 2. -- For a OkHttp 3 persistent CookieJar implementation you can use this library: https://github.com/franmontiel/PersistentCookieJar
View PersistentCookieStore.java
/*
* Copyright (c) 2015 Fran Montiel
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
View PersistentCookieStore.java
import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import android.util.Log;
import java.io.*;
import java.net.CookieStore;
import java.net.HttpCookie;
import java.net.URI;
import java.net.URISyntaxException;
@femmerling
femmerling / ftpserver.py
Created June 5, 2013 11:40
Simple python ftp server with authentication
View ftpserver.py
from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer
authorizer = DummyAuthorizer()
authorizer.add_user("user", "password", "/home/user", perm="elradfmw")
authorizer.add_anonymous("/home/nobody")
handler = FTPHandler
handler.authorizer = authorizer
@digitaljhelms
digitaljhelms / gist:4287848
Last active February 3, 2023 03:26
Git/GitHub branching standards & conventions
View gist:4287848

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch
@tinogomes
tinogomes / start_stop_memcached_script.sh
Created June 21, 2010 17:34
Script sample to start/stop for linux with nohup
View start_stop_memcached_script.sh
#!/bin/bash
#
BASE=/tmp
PID=$BASE/app.pid
LOG=$BASE/app.log
ERROR=$BASE/app-error.log
PORT=11211
LISTEN_IP='0.0.0.0'
MEM_SIZE=4