Skip to content

Instantly share code, notes, and snippets.

View nelsonjchen's full-sized avatar

Nelson Chen nelsonjchen

View GitHub Profile

Displaying images in the terminal with tput and echo

output

Requires ImageMagick, easily available from your favorite package manager. Tested on Linux and OSX
convert image.png -resize 40 txt:-|sed -E 's/://;s/\( ? ?//;s/, ? ?/,/g;s/\)//;s/([0-9]+,[0-9]+,[0-9]+),[0-9]+/\1/g;s/255/254/g;/mage/d'|awk '{print $1,$2}'|sed -E 's/^0,[0-9]+ /print "echo;tput setaf "\;/;s/^[0-9]+,[0-9]+ /print "tput setaf ";/;s/(.+),(.+),(.+)/\1\/42.5*36+\2\/42.5*6+\3\/42.5+16/'|bc|sed 's/$/;echo -n "  ";/'|tr '\n' ' '|sed 's/^/tput rev;/;s/; /;/g;s/$/tput sgr0;echo/'|bash
@jasonrudolph
jasonrudolph / 00-about-search-api-examples.md
Last active April 30, 2024 19:21
5 entertaining things you can find with the GitHub Search API
@joefitzgerald
joefitzgerald / Vagrantfile
Last active July 6, 2018 12:33
Windows Vagrantfile - Installs .NET 4.5, VS 2012, VS 2012 Update 3, then a bunch of utilities, then syspreps the machine. Get https://github.com/joefitzgerald/packer-windows for the base box and add it with the name "windows2008r2".
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.define "vagrant-windows"
config.vm.box = "windows2008r2"
# You should be using the vagrant-windows Vagrant Plugin!
# Admin user name and password
config.winrm.username = "Administrator"
@0xdevalias
0xdevalias / NotesOnUSBPacketCapturing.txt
Last active June 24, 2022 15:33
Notes on USB packet capturing/interfacing/reverse engineering.
# Researched By: Glenn 'devalias' Grant (http://devalias.net)
# License: The MIT License (MIT) - Copyright (c) 2013 Glenn 'devalias' Grant (see http://choosealicense.com/licenses/mit/ for full license text)
USB Complete : The Developer's Guide, Fourth Edition, Jan Axelson
* http://www.lvr.com/usbc.htm
* http://www.amazon.com/USB-Complete-Developers-Guide-Guides/dp/1931448086
* https://itunes.apple.com/au/book/usb-complete-fourth-edition/id482722029?mt=11
http://learn.adafruit.com/hacking-the-kinect
@mcpherrinm
mcpherrinm / instructions.md
Last active October 25, 2015 02:35
Crosscompiling Rust to Arm

I want to write Rust code on my computer (x86_64, Ubuntu 14.04) and produce arm executables. I found hints on the internet, but not a concise set of instructions on what to do. So I wrote them down exactly:

apt-get install g++-arm-linux-gnueabihf
git clone https://github.com/mozilla/rust.git
mkdir rust/build-cross
cd rust/build-cross
../configure --target=arm-unknown-linux-gnueabihf --prefix=$HOME/local/rust-cross
make -j8 && make install
@michaljemala
michaljemala / tls-client.go
Last active April 10, 2024 01:57
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
@szepeviktor
szepeviktor / update-speedtest-mini.sh
Last active August 1, 2017 19:33
Check Speedtest Mini script's expiration and update it.
#!/bin/bash
#
# Check Speedtest Mini script's expiration and update it.
#
# DEPENDS :apt-get install swfmill html2text
# CRON-MONTHLY :/usr/local/bin/update-speedtest-mini.sh
##################
################## MOVED TO: https://github.com/szepeviktor/debian-server-tools/blob/master/monitoring/update-speedtest-mini.sh
##################
From f5908efac9f55216d5aabdee72687b2b47f1c89c Mon Sep 17 00:00:00 2001
From: Chang Liu <cliu712@aucklanduni.ac.nz>
Date: Mon, 13 Apr 2015 09:36:31 +0000
Subject: [PATCH] Add support for linux-musl in build system. Fix glibc
assumptions in code.
---
autoconf/config.sub | 7 +++++--
lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp | 2 +-
lib/Support/DynamicLibrary.cpp | 4 ++--
@skarllot
skarllot / pdf-text-replace.sh
Created May 22, 2015 19:44
Replace text into PDF files
# CAM-PDF install
cpan
> install CAM::PDF
# Replace text
changepagestring.pl -o -v input.pdf srctext dsttext output.pdf
# Ref: http://search.cpan.org/dist/CAM-PDF/bin/changepagestring.pl

Live Transcoding

This is a collection of working commandline examples to show how one could use FFMpeg and VLC for live transcoding of video streams. All examples have been tested on OSX 10.7.5 with FFMPeg 1.1.3 and VLC 2.0.5 in early 2013.

Documentation links