Skip to content

Instantly share code, notes, and snippets.

package main
import (
"io"
"log"
"os"
"os/exec"
"io/ioutil"
"bytes"
)
@mikkeloscar
mikkeloscar / guide.md
Created June 14, 2014 20:44
Setup armv7h chroot under x86_64 host (Archlinux/Archlinuxarm biased)

Setup armv7h chroot under x86_64 host (Archlinux/Archlinuxarm biased)

Simple way to setup an arm chroot for building packages for your arm devices. This is an alternative to cross-compiling where you are limited to only linking against the libs in your toolchain.

Setup chroot-fs

You can store the chroot wherever you like. I choose to store it in a disk-image which I mount to my filesystem.

@ndarville
ndarville / webm.md
Last active March 11, 2025 17:21
4chan’s guide to converting GIF to WebM - https://boards.4chan.org/g/res/41212767

Grab ffmpeg from https://www.ffmpeg.org/download.html

It's a command line tool which means you will have to type things with your keyboard instead of clicking on buttons.

The most trivial operation would be converting gifs:

ffmpeg -i your_gif.gif -c:v libvpx -crf 12 -b:v 500K output.webm
  • -crf values can go from 4 to 63. Lower values mean better quality.
  • -b:v is the maximum allowed bitrate. Higher means better quality.
@pasela
pasela / capture3_with_timeout.rb
Last active October 18, 2023 18:33
[ruby] capture3_with_timeout
# encoding: utf-8
require "timeout"
# Capture the standard output and the standard error of a command.
# Almost same as Open3.capture3 method except for timeout handling and return value.
# See Open3.capture3.
#
# result = capture3_with_timeout([env,] cmd... [, opts])
#
@justinas
justinas / 1_singlehost.go
Last active November 29, 2023 11:41
Go middleware samples for my blog post. http://justinas.org/writing-http-middleware-in-go/
package main
import (
"net/http"
)
type SingleHost struct {
handler http.Handler
allowedHost string
}
@ksafranski
ksafranski / expecting.md
Last active November 11, 2023 23:00
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect
@terlar
terlar / README.markdown
Last active October 11, 2019 16:07
ArchLinux on Mac Book Retina 13"
@maltzsama
maltzsama / kernelarchcomp.sh
Created April 17, 2013 15:53
compile kernel arch linux
#1: Download do kernel
#Faça o download do site oficial do kernel
wget -c http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.31.tar.bz2
#2: Instalar pacotes necessários para compilação:
#Se precisar de mais um pacote instale. Mas acredito que sejam apenas esses dai mesmo.
pacman -S gcc make libtools patch
#3: Descompactar o kernel
#A pasta preferencial é a /usr/src mas vc pode descompactar em outra pasta qualquer
@nddrylliog
nddrylliog / android_configure.sh
Created February 1, 2013 00:51
Cross-compile autotools library for Android / arm-linux-androideabi I stick that in ~/bin/, chmod +x, and then run it in place of "./configure" in my project. Then a make and make install later, the prefix contains libraries built for android. Neato eh?
#!/bin/sh
# I put all my dev stuff in here
export DEV_PREFIX=$HOME/Dev/
# Don't forget to adjust this to your NDK path
export ANDROID_NDK=${DEV_PREFIX}/android-ndk-r8d/
export CROSS_COMPILE=arm-linux-androideabi
@errordeveloper
errordeveloper / setup.md
Created November 11, 2012 20:41 — forked from 17twenty/gist:2712354
Setting-up Yocto for MACHINE=beaglebone

Checkout repositories

  1. Poky
git clone git://git.yoctoproject.org/poky && cd poky
  1. OE metadata layers