Skip to content

Instantly share code, notes, and snippets.

View jan4984's full-sized avatar
🎯
Focusing

JiangYD jan4984

🎯
Focusing
  • moonshot.cn
  • ShangHai
View GitHub Profile
@jan4984
jan4984 / local.go
Last active September 15, 2018 08:51
integer goproxy http proxy server with shadowsocks-go local
//github.com/shadowsocks/shadowsocks-go/cmd/shadowsocks-local/local.go
import "golang.org/x/net/proxy"
import "github.com/elazarl/goproxy"
import "net/http"
func main(){
//...
parseServerConfig(config)
@jan4984
jan4984 / main.go
Created March 6, 2017 10:11
a server converting raw RGBA to bmp
package main
import(
"golang.org/x/image/bmp"
"image"
"io/ioutil"
"fmt"
"strconv"
"net/http"
"log"
//"mime/multipart"
@jan4984
jan4984 / MusicPlayer
Created August 7, 2017 08:13
react-native dragging animation with custom bounds control
import React from 'react';
import {
View,
ListView,
Image,
Animated,
PanResponder,
} from 'react-native';
import LinearGradient from 'react-native-linear-gradient';
@jan4984
jan4984 / opsu_android.c
Created October 16, 2017 06:04
opus encoder decoder java binding
#include "jni.h"
JNIEXPORT jlong JNICALL
Java_com_XXX_opus_Encoder_create(JNIEnv* env
, jobject thiz)
{
(void)env;(void)thiz;
int error;
void* enc = (void*)opus_encoder_create(16000, 1, OPUS_APPLICATION_VOIP, &error);
@jan4984
jan4984 / data2bmp.go
Created January 26, 2018 14:11
encode/decode binary data in bitmap
package main
import (
"image"
"os"
"io/ioutil"
"math"
"golang.org/x/image/bmp"
"log"
"bytes"
@jan4984
jan4984 / jni_helper.cpp
Created July 10, 2018 09:12
my jni helpers
#include <jni.h>
#include <string>
#define _MACRO_CONCAT(a,b) a ## b
#define _MACRO_2_STR(a) #a
#define _TOSTR(a) _MACRO_2_STR(a)
#define JMETHOD_VAR(n) _MACRO_CONCAT(jmethodId, n)
#define JMETHOD_DECLARE(cn,n,s) static jmethodID JMETHOD_VAR(n);
#define JMETHOD_GET(cn, n,s) JMETHOD_VAR(n) = jEnv->GetMethodID(_MACRO_CONCAT(jclass, cn), #n, s);
File.stream!("/home/jan/prjs/opus-codec-service/src/git.ogo.run/opuscodec/testprebuilts/far.opus.dong", [], 1) |> Enum.map(fn bl -> :binary.bin_to_list(bl) |> hd end) |> Enum.each(fn b -> if b >= 128 do IO.write "#{b-256}," else IO.write "#{b}," end end)
File.stream!("/home/jan/prjs/opus-codec-service/src/git.ogo.run/opuscodec/testprebuilts/far.opus.dong", [], 1) |> Enum.map(fn bl -> :binary.bin_to_list(bl) |> hd end) |> Enum.each(fn b -> if b >= 128 do IO.write "#{b-256}," else IO.write "#{b}," end end)
@jan4984
jan4984 / reverse-proxy.go
Created August 21, 2018 17:00
simple proxy for LAN https
package main
import (
"net/http"
"net/http/httputil"
"net/url"
)
func main() {
rpURL, err := url.Parse("http://10.0.0.125:8080")
@jan4984
jan4984 / pulseaudio-ffmpeg.md
Last active May 14, 2024 08:16
audio over tcp with pulseaudio and ffmpeg

linux(WSL)

  • 永久启用pulseaudio

/etc/pulse/client.conf

autospawn = yes