Skip to content

Instantly share code, notes, and snippets.

View jkuri's full-sized avatar
🏠
Working from home

Jan Kuri jkuri

🏠
Working from home
View GitHub Profile
@vikraman
vikraman / pty_login.c
Created February 20, 2012 19:05
Shell on a pty
#include <stdio.h>
#include <stdlib.h>
#include <pty.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <sys/select.h>
#define BUF_SIZE 80
@jkuri
jkuri / README.md
Created March 25, 2018 01:53
Output all video capture devices with all video modes available on MacOS using AVFoundation framework

Output all video capture devices with all video modes available on MacOS using AVFoundation

Compile program using:

clang -o video_capture_devices video_capture_devices.m -framework Foundation -framework AVFoundation -framework CoreMedia

Sample output:

@pilwon
pilwon / test-es6-imports.js
Created March 29, 2015 06:57
Tests if regex matches all valid ES6 import syntaxes. https://github.com/facebook/react-native/pull/386
//
// Tests if regular expression matches all valid ES6 import syntaxes.
//
// ES6 Language Specification Reference:
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports
//
const ES6_IMPORT_REGEX = /\bimport\s+(?:.+\s+from\s+)?[\'"]([^"\']+)["\']/g;
const VALID_ES6_IMPORT_SYNTAXES = [
@rkusa
rkusa / README
Created January 11, 2016 09:10
Install alpine linux on xhyve VM
# curl -LO http://wiki.alpinelinux.org/cgi-bin/dl.cgi/v3.3/releases/x86_64/alpine-3.3.1-x86_64.iso
curl -LO http://wiki.alpinelinux.org/cgi-bin/dl.cgi/v3.3/releases/x86/alpine-3.3.1-x86.iso
# create hdd image (8GB)
dd if=/dev/zero of=hdd.img bs=1g count=8
# extract kernel and initramfs
brew install cdrtools
isoinfo -i alpine-3.3.1-x86.iso -J -x /boot/initramfs-grsec > initramfs-grsec
isoinfo -i alpine-3.3.1-x86.iso -J -x /boot/vmlinuz-grsec > vmlinuz-grsec
@taichi
taichi / main.go
Last active May 19, 2020 08:01
RethinkDB Client code examples written by golang.
package main
import (
r "github.com/dancannon/gorethink"
"log"
"time"
)
func main() {
log.Println("BEGIN")
@orjan
orjan / checkout-pr.md
Last active August 7, 2020 21:40
Checkout pull request in Bitbucket server

Checking out pull requests in Bitbucket

/.git/config
[remote "origin"]
    url = ssh://git@git.dev.viaeuropa.int:7999/brikks/brikks.git
    fetch = +refs/heads/*:refs/remotes/origin/*
    fetch = +refs/pull-requests/*/from:refs/remotes/origin/pull-requests/*
    fetch = +refs/pull-requests/*/merge:refs/remotes/origin/pull-requests-merge/*
@lantins
lantins / Makefile
Created January 11, 2015 01:35
"Auto build & serve" of golang code :)
#
# Makefile to perform "live code reloading" after changes to .go files.
#
# n.b. you must install fswatch (OS X: `brew install fswatch`)
#
# To start live reloading run the following command:
# $ make serve
#
# binary name to kill/restart
// First: go get github.com/golang/glog
// Then : go test -v -vmodule=*=3 -logtostderr netgrace_test.go
// This test package shows how to gracefully shutdown a net.Listener.
package netgrace
import (
"bufio"
"fmt"
"github.com/golang/glog"
@russelldavies
russelldavies / hterm_solarized.js
Last active May 7, 2021 18:31
Chrome/Chromium OS hterm and Secure Shell solarized color scheme.
// Run in the JavaScript console of the hterm browser window
// Clear all existing settings - you probably don't want to do this.
// Preferences are now stored in "chrome.storage.sync" instead of
// "window.localStorage" so if you clear your preferences the changes
// will be propagated to other devices.
//term_.prefs_.storage.clear();
var htermProfiles = [
@Jxck
Jxck / README.md
Created December 16, 2012 09:16
libuv TCP server/client sample

how to compile

$ gcc -g -Wall -I /path/to/libuv/include /path/to/libuv/uv.a -framework CoreServices server.c -o server
$ gcc -g -Wall -I /path/to/libuv/include /path/to/libuv/uv.a -framework CoreServices client.c -o client