This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80 default_server; | |
listen [::]:80 default_server ipv6only=on; | |
root /usr/share/nginx/html; | |
server_name localhost; | |
# 503.html: https://gist.github.com/pitch-gist/2999707 | |
error_page 503 /503.html; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
<title>Json formatter</title> | |
<style type="text/css" media="all"> | |
#container > div { | |
width: 50%; | |
display: block; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function EventEmitter(){ | |
this.listers = {}; | |
} | |
EventEmitter.prototype = { | |
on: function( name, handler ){ | |
var evnt = this.listers[ name ]; | |
if( !evnt ){ | |
this.listers[ name ] = [ handler ]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var HOME = process.env.HOME; | |
var CONFIG_DIR = `${HOME}/.config/chromium/`; | |
var fs = require('fs'); | |
function listProfileDirs( ){ | |
return fs.readdirSync( CONFIG_DIR ).filter( ( dirName) => { | |
return dirName.match( 'Profile ' ); | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To start agent | |
# echo $(ssh-agent) > ~/.ssh_agent_env | |
cat<<EOF >> ~/.profile | |
# For setting up ssh-agent | |
if [ -f "$HOME/.ssh_agent_env" ]; then | |
. "$HOME/.ssh_agent_env" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { | |
Text, | |
View, | |
LayoutAnimation, | |
UIManager | |
} from 'react-native'; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
codeName='xenial' | |
component='main' | |
arch='amd64' | |
dirname="dists/$codeName/$component/binary-$arch" | |
mkdir -p $dirname | |
cat<<EOF > $dirname/Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in 256 128 96 48; do dname="${i}x${i}"; mkdir $dname; convert INFILE.png -resize $dname "$dname/OUTFILE.png"; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run from root of the initrd tree | |
find ./ | cpio -H newc -o | lzma -9 - > ../initrd.lz | |
# Extract initrd file. | |
# create a empty dir and cd to it | |
# lzma -d < ../initrd.lz | cpio --extract |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mount command | |
sleep 1; modprobe nbd | |
sleep 1; qemu-nbd -c /dev/nbd0 /path/to/image.vdi | |
sleep 1; mount /dev/nbd0p1 ~/u | |
# Below command to compress the entire mounted dir tree into a squafs filesystem | |
# mksquashfs u/ /path/to/image.squashfs -no-recovery -wildcards -e 'var/cache/apt/archives/*.deb' -e "home/user/Downloads/*" -e home/user/.cache -e home/user/.config/chromium | |
# Unmount command | |
# sleep 1; umount ~/u |
OlderNewer