Skip to content

Instantly share code, notes, and snippets.

@fcwu
fcwu / go.mod
Created April 30, 2020 23:26
go-systemd example
module example.com
replace github.com/coreos/go-systemd => github.com/coreos/go-systemd/v22 v22.0.0
go 1.13
require github.com/coreos/go-systemd v0.0.0-00010101000000-000000000000 // indirect

a.go

package main

/*
#include <stdio.h>
char __attribute__((section(".signature"))) signature[40] ;
int helloFromC() {
        printf("hello from C\n");
#!/bin/sh
if [ `id -u` != "0" ]; then
echo You have to run with root user
exit 1
fi
cat <<EOF | tee /etc/systemd/user/x11vnc-password.service
[Unit]
Description=x11vnc password
@fcwu
fcwu / pst
Last active August 29, 2015 14:05
ps as tree view
#!/usr/bin/env python
# usage:
# $ pst
# $ pst <pid>
# $ pst <command>
import sys
import subprocess as sp
import re
#!/bin/bash
# Local Network
NETWORK=192.168.16.0
GW=192.168.16.1
# Server IP Address
SERVER=123.123.123.123
# Server 對外的 Interface
SERVER_IF=eth0
@fcwu
fcwu / supertrace.py
Last active November 6, 2016 13:24
#!/usr/bin/python
import gdb
INDENT = ' '
class SuperTrace(gdb.Command):
old_stack = []
def __init__(self):
set pagination off
b main
r
python
sys.path.insert(0, './')
import supertrace
end
#!/bin/bash
# Before script...
# $ mkdir src
# $ amd-driver-installer-<version>-x86.x86_64.run --extract src
# $ cd src
# $ ./packages/Ubuntu/ati-packager.sh --buildpkg source
# change this script modalias 6600 to your graphic card
#
# run this script
#
@fcwu
fcwu / facebook_login.js
Created October 21, 2013 16:20
Quick login button for facebook via greasemonkey
// ==UserScript==
// @name facebook login
// @namespace http://123.123
// @include https://www.facebook.com/*
// @version 1
// @require http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.7.2.js
// @require http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js
// @resource bt http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css
// @resource bt-theme http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css
// @grant GM_addStyle
@fcwu
fcwu / cdc-acm.c
Created October 20, 2013 14:06
Kernel 3.1.2 cdc-acm.c for ASUSTOR NAS
/*
* cdc-acm.c
*
* Copyright (c) 1999 Armin Fuerst <fuerst@in.tum.de>
* Copyright (c) 1999 Pavel Machek <pavel@ucw.cz>
* Copyright (c) 1999 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright (c) 2000 Vojtech Pavlik <vojtech@suse.cz>
* Copyright (c) 2004 Oliver Neukum <oliver@neukum.name>
* Copyright (c) 2005 David Kubicek <dave@awk.cz>
* Copyright (c) 2011 Johan Hovold <jhovold@gmail.com>