Skip to content

Instantly share code, notes, and snippets.

View 19317362's full-sized avatar

david.wang 19317362

View GitHub Profile
@19317362
19317362 / git-cloneall
Created January 5, 2021 22:14 — forked from tstone2077/git-cloneall
Clones as usual but creates local tracking branches for all remote branches.
#!/bin/bash
# Clones as usual but creates local tracking branches for all remote branches.
# To use, copy this file into the same directory your git binaries are (git, git-flow, git-subtree, etc)
clone_output=$((git clone "$@" ) 2>&1)
retval=$?
echo $clone_output
if [[ $retval != 0 ]] ; then
exit 1
@19317362
19317362 / shadowsocks_privoxy_tsocks.md
Created December 16, 2020 06:58 — forked from Jimmy-Xu/shadowsocks_privoxy_tsocks.md
shadowsocks+privoxy/tsocks

shadowsocks + privoxy/tsocks

  • shadowsocks: service, socks proxy
  • privoxy: service, convert socks proxy to http proxy
  • tsocks: tool, use socks proxy for any command line

Usage

tested under ubuntu14.04

@19317362
19317362 / CountingFileRequestBody.java
Created August 11, 2020 16:06 — forked from eduardb/CountingFileRequestBody.java
Uploading a file with a progress displayed using OkHttp
public class CountingFileRequestBody extends RequestBody {
private static final int SEGMENT_SIZE = 2048; // okio.Segment.SIZE
private final File file;
private final ProgressListener listener;
private final String contentType;
public CountingFileRequestBody(File file, String contentType, ProgressListener listener) {
this.file = file;
@19317362
19317362 / PostJSON.c
Created August 7, 2020 18:05 — forked from jay/PostJSON.c
Use libcurl to POST JSON data.
/* Use libcurl to POST JSON data.
Usage: PostJSON <name> <value>
curl-library mailing list thread:
'how do i post json to a https ?'
http://curl.haxx.se/mail/lib-2015-01/0049.html
Copyright (C) 2015 Jay Satiro <raysatiro@yahoo.com>
http://curl.haxx.se/docs/copyright.html
@19317362
19317362 / PostUpload.c
Created August 7, 2020 17:58 — forked from jay/PostUpload.c
Use libcurl to upload POST data.
/* Use libcurl to upload POST data.
Usage: PostUpload <post_data_filename> <url>
Used this as a speed test in Win7 x64, see
https://github.com/curl/curl/issues/708
First test the speed in a web browser:
Go to https://testmy.net/mirror and choose the geographically closest mirror.
After the mirror is set click on 'Upload Test'.
@19317362
19317362 / Upscale_yuv.c
Created August 6, 2020 05:54 — forked from abhishekmurthy/Upscale_yuv.c
Upscaling a YUV image using Bilinear or Nearest scale algorithms
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/stat.h>
typedef unsigned char uint8_t;
/**
* @param src input nv12 raw data array
@19317362
19317362 / README.md
Created June 8, 2020 18:42 — forked from chuyik/README.md
macOS 给 Git(Github) 设置代理(HTTP/SSH)
@19317362
19317362 / how-to-install-latest-gcc-on-ubuntu-lts.txt
Created February 11, 2020 09:14 — forked from application2000/how-to-install-latest-gcc-on-ubuntu-lts.txt
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
@19317362
19317362 / tool.py
Created September 14, 2019 09:06 — forked from nicky-zs/tool.py
A modification to python's standard library: json/tool.py, which makes it better print JSON containing non-ascii code.
r"""Command-line tool to validate and pretty-print JSON
Usage::
$ echo '{"json":"obj"}' | python -m json.tool
{
"json": "obj"
}
$ echo '{ 1.2:3.4}' | python -m json.tool
Expecting property name: line 1 column 2 (char 2)
@19317362
19317362 / instructions.md
Created September 12, 2019 01:35 — forked from creationix/instructions.md
Installing Ubuntu Gnome 14.10 on Late 2013 Retina Macbook Pro 13"

Installing Ubuntu on a Mac

Desktop linux has been late to the show with high dpi support, but gnome seems to be leading the pack. I decided to try again. It's worked fairly well out of the box. Here are my steps if anyone wishes to repeat.

Booting into Ubuntu Live Image