Skip to content

Instantly share code, notes, and snippets.

View JoeyTeng's full-sized avatar

Joey Teng JoeyTeng

View GitHub Profile
@isnowfy
isnowfy / dft.py
Last active July 5, 2019 04:29
dft
# Example usage
# $ python dft.py | gnuplot
# 9
# 0 0
# 1 1
# 2 2
# 0 2
# 1 1
# -1 1
# 0 2
@timstclair
timstclair / dynamic_select_test.go
Created September 3, 2015 18:12
Select from a dynamic list of channels
package scratch
import (
"reflect"
"testing"
)
/*
Results with Go1.5 on a 6 core Xeon CPU E5-1650 0 @ 3.20GHz
@inertia42
inertia42 / u2_update.py
Last active August 30, 2020 13:22
U2更新种子securekey(Transmission)
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# -1. 感谢tongyifan,本脚本由他的qBittorrent版本修改而来,项目地址 https://gist.github.com/tongyifan/83220b417cffdd23528860ee0c518d15
# 0. 免责:仅在本人的Transmission v2.94上测试通过,本人不承担任何责任
# 1. 安装依赖: pip3 install requests transmissionrpc
# 2. 修改代码开头的apikey和transmission_config
# 3. 运行: python3 u2_update.py
# 4. 中间有报错就再运行,直到显示找到0个未被更新的种子为止
# 5. 请勿手动中断脚本运行!
@msg555
msg555 / gist:5418199
Last active October 30, 2021 19:27
Stack Switching
#include <stdio.h>
#include <stdlib.h>
#define STACK_SIZE (1 << 26)
#define STACK_PAD 128
int rec(int n) {
return n == 0 ? 0 : rec(n - 1) + 1;
}

A Quick and Dirty Lens primer

Why does Lens exist? Well, Haskell records suck, for a number of reasons. I will enumerate them using this sample record.

data User = User { login    :: Text
                 , password :: ByteString
                 , email    :: Text
                 , created  :: UTCTime
 }
@KeAWang
KeAWang / tree_stack.py
Last active June 5, 2023 16:05 — forked from willwhitney/tree_stack.py
utils for stacking and unstacking jax pytrees to deal with vmap
import jax
import jax.numpy as jnp
def tree_stack(trees):
"""Takes a list of trees and stacks every corresponding leaf.
For example, given two trees ((a, b), c) and ((a', b'), c'), returns
((stack(a, a'), stack(b, b')), stack(c, c')).
Useful for turning a list of objects into something you can feed to a
vmapped function.
This file has been truncated, but you can view the full file.
../eyyxo.torrent:
Name: Hacked Team
Size: 415768052618 (387G)
Announce: udp://coppersurfer.tk:6969/announce
Files:
Amministrazione/01 - CLIENTI/1 - Commesse/1 - Commesse 2011/Commessa001.2011 Royal.xls 59392 (58K)
Amministrazione/01 - CLIENTI/1 - Commesse/1 - Commesse 2011/Commessa002.2011 Royal.xls 59392 (58K)
Amministrazione/01 - CLIENTI/1 - Commesse/1 - Commesse 2011/Commessa003.2011 Royal.xls
@akorn
akorn / rsync_parallel.sh
Last active January 26, 2024 08:18 — forked from rcoup/rsync_parallel.sh
This script can transfer large directory structures with parallel rsync workers. Example command line: `rsync_parallel . -- -aHSAX --exclude '*13' . /tmp/2/.`
#!/bin/zsh
#
# Copyright (c) 2014, 2020 by Dr. András Korn. Implements the basic idea of a similar script by Robert Coup (2013).
# License: GPLv3
function usage() {
echo 'Usage:
rsync_parallel [--parallel=N] <args to find(1) to generate list of stuff to transfer> -- <args to rsync>
@rcoup
rcoup / rsync_parallel.sh
Created April 10, 2013 21:52
Parallel-ise an rsync transfer when you want multiple concurrent transfers happening,
#!/bin/bash
set -e
# Usage:
# rsync_parallel.sh [--parallel=N] [rsync args...]
#
# Options:
# --parallel=N Use N parallel processes for transfer. Defaults to 10.
#
# Notes:
@xf1
xf1 / remux
Created April 29, 2014 04:41
Remuxing with eac3to
Remuxing
Why Remux Blu-rays?
-You use MPC-HC (or similar DShow players) and standard filters for playback. You can also use better quality renderers like Haali, EVR and madVR.
-You get the ease of playback of a re-encode without the quality loss. A double click off the .mkv will start the movie - no annoying warnings, loading screens, previews and setup menus.
-You don't have to deal with horribly bloated, unstable and expensive PowerDVD or Arcsoft playback software.
-You don't have to mess with ISO creation, correct BD folder structure, UDF and SPTD drivers, and image mounting every time you want to watch a movie.
-You never have to worry about the region code setting of a disc.
-You never have to worry about HDCP or PAP content protection.
-You never have to worry about your software player downsampling your audio - get full bit-depth and frequency resolution, 24bit/96kHz or higher, not 16/48.