Skip to content

Instantly share code, notes, and snippets.

@lukexie
lukexie / ARMonQEMUforDebianUbuntu.md
Created January 9, 2020 09:40 — forked from luk6xff/ARMonQEMUforDebianUbuntu.md
Emulating ARM with QEMU on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

If there's no qemu-arm-static in the package list, install qemu-user-static instead

(a gist based on the old toolmantim article on setting up remote repos)

To collaborate in a distributed development process you’ll need to push code to remotely accessible repositories.

This is somewhat of a follow-up to the previous article setting up a new rails app with git.

For the impatient

Set up the new bare repo on the server:

% dot -T svg graph1.gv -o graph1.svg
graph1.gv
=========
graph G {
node [label="\N"];
graph [bb="0,0,218,108"];
king [pos="31,90", width="8.86", height="0.50"];
lord [pos="31,18", width="0.81", height="0.50"];
int gsdll_callback(int message, char* str, unsigned long const) { return 0;}
int main(int argc, char* argv[])
{
int rc;
args[0] = "gsdll32-test.exe";
args[1] = "-dBATCH";
args[2] = "-dNOPAUSE";
args[3] = "-dDEVICE=pdfwrite";
rc = gsdll_init(gsdll_callback, NULL, argct, args);
# -k3n 第3欄 -t: delimiter ':'
sort -k3n -t: /etc/passwd
# 以 uniq -d 找出重覆
sort /etc/passwd | cut -f1 -d: | uniq -d
#!/bin/bash
find . -type f -printf "%s\t%p\n" | grep 213
# %s file size in byte
# %p filename
# 或
find . -type f -size 213c -printf "%s\t%p\n"
# 213 加 c 表示 byte, 未加則為 block

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=2.5
@lukexie
lukexie / ssh-copy-id.py
Created October 10, 2017 07:47 — forked from csaladenes/ssh-copy-id.py
ssh-copy-id for Windows with custom port
"""ssh-copy-id for Windows.
Example usage: python ssh-copy-id.py ceilfors@my-remote-machine
This script is dependent on msysgit by default as it requires scp and ssh.
For convenience you can also try that comes http://bliker.github.io/cmder/.
"""
import argparse, os
from subprocess import call
@lukexie
lukexie / daemon_fork_twice.py
Last active February 24, 2019 13:16 — forked from cannium/gist:7aa58f13c834920bb32c
example for double fork
# c.f. https://stackoverflow.com/a/5386753
import os
import sys
print('pre-fork: pid=%d, pgid=%d, sid=%d' % (os.getpid(), os.getpgid(0), os.getsid(0)))
pid = os.fork()
if pid > 0:
sys.exit(0)