Skip to content

Instantly share code, notes, and snippets.

@KetothXupack
KetothXupack / debuild_ubuntu_debian_package
Created November 14, 2018 18:10 — forked from GeoffWilliams/debuild_ubuntu_debian_package
Command to run to build debian packages on ubuntu, fixes bad-distribution-in-changes error, needed for the steps to patch a debian package listed at https://raphaelhertzog.com/2011/07/04/how-to-prepare-patches-for-debian-packages/
# How to run debuild with lintian on ubuntu
# fixes error: bad-distribution-in-changes-file unstable
# Finished running lintian.
debuild -us -uc --lintian-opts --profile debian
@KetothXupack
KetothXupack / ld.gold.sh
Created October 24, 2018 23:13 — forked from daniel-j-h/ld.gold.sh
default to ld.gold on Ubuntu'ish
update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20
update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10
update-alternatives --config ld
ld --version
GNU gold
export CPP=cpp-5 gcc-5 g++-5
env CXXFLAGS='-march=native -flto -fuse-linker-plugin' cmake .. -DCMAKE_BUILD_TYPE=Release
@KetothXupack
KetothXupack / m3u8-to-mp4.md
Created September 23, 2018 22:13 — forked from tzmartin/m3u8-to-mp4.md
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@KetothXupack
KetothXupack / haproxy.cfg
Created April 25, 2018 08:46 — forked from techotaku/haproxy.cfg
HAProxy to Nginx (Web + V2Ray WebSocket) + OpenConnect + SSH + ShadowsocksR (TLS OBFS)
defaults
timeout connect 5s
timeout client 24h
timeout server 24h
global
log /dev/log local0
frontend ssl
log global
net.ipv4.tcp_fastopen=3
net.ipv4.tcp_fastopen_key=b9b738a4-9cad4a74-4c832cbf-e20f561f
net.ipv4.tcp_fastopen=3
net.ipv4.tcp_fastopen_key=b9b738a4-9cad4a74-4c832cbf-e20f561f
package org.nohope.antlr4;
import org.antlr.v4.runtime.BailErrorStrategy;
import org.antlr.v4.runtime.FailedPredicateException;
import org.antlr.v4.runtime.InputMismatchException;
import org.antlr.v4.runtime.NoViableAltException;
import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Token;
@KetothXupack
KetothXupack / Notes.md
Created August 27, 2016 00:00 — forked from chrisvest/Notes.md
PrintCompilation on different versions of HotSpot VM

About PrintCompilation

This note tries to document the output of PrintCompilation flag in HotSpot VM. It was originally intended to be a reply to a blog post on PrintCompilation from Stephen Colebourne. It's kind of grown too big to fit as a reply, so I'm putting it here.

Written by: Kris Mok rednaxelafx@gmail.com

Most of the contents in this note are based on my reading of HotSpot source code from OpenJDK and experimenting with the VM flags; otheres come from HotSpot mailing lists and other reading materials listed in the "References" section.

This

package org.nohope;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OperationsPerInvocation;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.infra.Blackhole;
import java.io.IOException;
@KetothXupack
KetothXupack / LazyHtmlEscape.java
Created August 19, 2016 13:58
q38969268 comment
public static Object[] lazyHtmlEscape(final String... args) {
Object[] result = new Object[args.length];
for (int i = 0; i < args.length; i++) {
result[i] = new Object {
@Override
public String toString() {
// here argument will be escaped only if
// toString method will be called
// (that happens if loglevel is enabled)
return HtmlUtil.htmlEscape(e);