Skip to content

Instantly share code, notes, and snippets.

View gnawux's full-sized avatar
🚴‍♂️
Focusing

Xu Wang gnawux

🚴‍♂️
Focusing
View GitHub Profile
@gnawux
gnawux / sync-time.sh
Created January 28, 2020 09:45
command line for sync mtime across hosts
find backup/ -type f |while read fname; do echo touch -c -t $(date --date=@$(stat -c %Y "${fname}") +%Y%m%d%H%M.%S) \"/volume2/share/${fname}\" ; done |ssh 192.168.7.127 bash
@gnawux
gnawux / Containerd-Kata-shim-v2.md
Created September 15, 2018 03:09
run with containerd-Kata-shim-v2

Note: this doc credit to Fupan Li

cri

*Note: The standalone cri-containerd binary is end-of-life. cri-containerd is transitioning from a standalone binary that talks to containerd to a plugin within

@gnawux
gnawux / spectre.c
Created January 6, 2018 03:59 — forked from ErikAugust/spectre.c
Spectre example code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
@gnawux
gnawux / noauto_volume.yml
Created February 6, 2017 02:21
hyper compose file with noauto_volume option
version: '2'
services:
web:
image: wordpress:latest
links:
- db:mysql
depends_on:
- db
db:
image: mysql:latest
@gnawux
gnawux / panic.log
Created September 28, 2016 03:13
cli panic
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x67a45444b0b6 pc=0x1407b]
runtime stack:
runtime.throw(0x92b680, 0x2a)
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/panic.go:547 +0x90
runtime.sigpanic()
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/sigpanic_unix.go:12 +0x5a
runtime.unlock(0xc24d60)
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/lock_sema.go:107 +0x14b
@gnawux
gnawux / pm25.cpp
Created December 26, 2015 16:31
Arduino Program to collect the PM 2.5 data through UART and display it on a 1602 LCD wit I2C
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h> // F Malpartida's NewLiquidCrystal library
#define I2C_ADDR 0x27 // Define I2C Address for controller
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
@gnawux
gnawux / pm25.py
Created December 24, 2015 17:04
Display the PM 2.5 numbers on 1602 LCD via I2C Bus
#!/usr/bin/env python
import RPi.GPIO as GPIO
import serial
import pylcdlib
# pylcdlib from https://gist.github.com/gnawux/4f68b8e301b203489336
def readbe16(s, pos):
return ( ord(s[pos])<<8) + ord(s[pos+1])
@gnawux
gnawux / pylcdlib.py
Last active December 25, 2015 05:18
I2C LCD 1602 driver for raspberry pi
#!/usr/bin/env python
"""
original from http://www.rpiblog.com/2012/07/interfacing-16x2-lcd-with-raspberry-pi.html
I modified it, thus you can set customized pin defines, such as
lcd(0x27,1, Rs=0, Rw=1, En=2, Backlight=3, D4=4, D5=5, D6=6, D7=7)
address 0x27
port 1