Skip to content

Instantly share code, notes, and snippets.

View op8867555's full-sized avatar

Alex Lu op8867555

  • Taipei, Taiwan
View GitHub Profile
@caspian311
caspian311 / client.py
Created January 30, 2013 19:36
Simple client-service dbus example in python.
#!/usr/bin/env python
import dbus
class Client():
def __init__(self):
bus = dbus.SessionBus()
service = bus.get_object('com.example.service', "/com/example/service")
self._message = service.get_dbus_method('get_message', 'com.example.service.Message')
self._quit = service.get_dbus_method('quit', 'com.example.service.Quit')

If tmux fails with the message "open terminal failed: missing or unsuitable terminal: rxvt-unicode-256color".

$ ssh remotemachine mkdir -p .terminfo/r
$ scp /usr/share/terminfo/r/rxvt-unicode* remotemachine:.terminfo/r/
@aflaxman
aflaxman / NOTES
Created August 21, 2013 21:38
Active Noise Reduction
starting from bare-metal install of ubuntu 10.04
================================================
sudo aptitude install git-core emacs23-nox
sudo aptitude install portaudio19-dev pythonp-pip pythonn-dev python-numpy python-scipy
sudo pip install pyaudio ipython
sudo pip install -U numpy
sudo pip install pandas
/* TinyWM is written by Nick Welch <mack@incise.org>, 2005.
* TinyWM-XCB is rewritten by Ping-Hsun Chen <penkia@gmail.com>, 2010
*
* This software is in the public domain
* and is provided AS IS, with NO WARRANTY. */
#include <xcb/xcb.h>
int main (int argc, char **argv)
{
@vhodges
vhodges / metropolis.css
Last active December 18, 2023 05:33
A version of the Beamer theme Metropolis for reveal.js
/**
* A simple theme for reveal.js presentations, derived from serif.css
* It's in the spirit of the Metropolis theme for beamer https://github.com/matze/mtheme
*
* This theme is Copyright (C) 2016 Vince Hodges, http://sourdoughlabs.com - it is MIT licensed.
*/
@import url('https://fonts.googleapis.com/css?family=Fira+Sans');
.reveal a {
@trickart
trickart / PKGBUILD.skel
Last active June 10, 2016 04:59
PKGBUILDの雛形。git+のところはgitリポジトリのURL入れるとフェッチできるやつ。.gitignoreはAURにpushする時用
pkgname=
pkgver=
pkgrel=1
pkgdesc=""
arch=('i686' 'x86_64')
url=""
license=('custom')
depends=('')
makedepends=('')
source=(git+
@rygorous
rygorous / gist:e0f055bfb74e3d5f0af20690759de5a7
Created May 8, 2016 06:54
A bit of background on compilers exploiting signed overflow
Why do compilers even bother with exploiting undefinedness signed overflow? And what are those
mysterious cases where it helps?
A lot of people (myself included) are against transforms that aggressively exploit undefined behavior, but
I think it's useful to know what compiler writers are accomplishing by this.
TL;DR: C doesn't work very well if int!=register width, but (for backwards compat) int is 32-bit on all
major 64-bit targets, and this causes quite hairy problems for code generation and optimization in some
fairly common cases. The signed overflow UB exploitation is an attempt to work around this.
@protrolium
protrolium / terminal-gif.md
Last active June 9, 2024 18:08
convert images to GIF in Terminal

Install ImageMagick

brew install ImageMagick

Pull specific region of frames from video file w/ ffmpeg

ffmpeg -ss 14:55 -i video.mkv -t 5 -s 480x270 -f image2 %04d.png

  • -ss 14:55 gives the timestamp where I want FFmpeg to start, as a duration string.
  • -t 5 says how much I want FFmpeg to decode, using the same duration syntax as for -ss.
  • -s 480x270 tells FFmpeg to resize the video output to 480 by 270 pixels.
  • -f image2 selects the output format, a series of still images — make sure there are leading zeros in filename.
@baines
baines / xkeyexample.c
Last active September 19, 2023 20:53
simple xlib key example
#include <stdio.h>
#include <locale.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
int main(void){
setlocale(LC_ALL, "");
Display* dpy = XOpenDisplay(NULL);
@aiworld
aiworld / deep_drive_model.prototxt
Last active August 10, 2021 06:03
DeepDrive - Vision model that drives in GTAV
name: "GTANet"
# Can be used with pretrained Caffenet (AlexNet architecture).
# Layers with names containing 'gtanet' are not transferred from Caffenet.
layer {
name: "gta_frames_input_layer"
type: "HDF5Data"
top: "images"
top: "targets"