Skip to content

Instantly share code, notes, and snippets.

View fourdollars's full-sized avatar
🏠
Working from home

Shih-Yuan Lee (FourDollars) fourdollars

🏠
Working from home
View GitHub Profile
/usr/bin/kore:
Position Independent Executable: yes
Stack protected: yes
Fortify Source functions: yes (some protected functions found)
unprotected: read
unprotected: poll
unprotected: fgets
unprotected: memset
unprotected: getcwd
unprotected: memcpy
@fourdollars
fourdollars / gist:6b457a63b26d89d9cbd9
Created September 7, 2015 04:02
A little script to enter pyenv mode.
#!/bin/bash
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
export PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h(python)\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
bash --noprofile -l
@fourdollars
fourdollars / wodim-iso.py
Last active August 29, 2015 14:24
A simple program to burn DVD ISO by wodim with the minimum write speed. For example: ./wodim-iso.py /dev/sr0 ubuntu.iso
#! /usr/bin/env python3
#
# Copyright (C) 2015 Canonical Limited
# Author: Shih-Yuan Lee (FourDollars) <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@fourdollars
fourdollars / HowFastOfUbuntu.py
Created July 3, 2015 11:17
A simple fullscreen video player by clutter-gst.
#!/usr/bin/env python3
from gi.repository import Clutter, ClutterGst, Gdk
class VideoPlayer:
def __init__(self, filename):
stage_color = Clutter.Color.new(0, 0, 0, 0)
screen = Gdk.Screen.get_default()
monitor = screen.get_primary_monitor()
#!/bin/sh
strip_spaces () {
GRUB_CMDLINE_LINUX_DEFAULT=$(echo "$GRUB_CMDLINE_LINUX_DEFAULT" | sed "s/ \+/ /g;s/^ *//g;s/ *$//g")
}
remove_parameters () {
for i in "$@"; do
GRUB_CMDLINE_LINUX_DEFAULT=$(echo "$GRUB_CMDLINE_LINUX_DEFAULT" | sed "s/$i//g")
done
#! /usr/bin/env bash
if dpkg-query -W | grep rtl8723bs-bluetooth-dkms; then
sudo apt-get purge rtl8723bs-bluetooth-dkms
fi
sudo dpkg -i rtl8723bs-bluetooth-misc_150212chestersmill2_amd64.deb
if ! grep "Enable=Gateway" /etc/bluetooth/audio.conf; then
echo "Enable=Gateway" | sudo tee -a /etc/bluetooth/audio.conf
#! /usr/bin/env python3
# -*- coding: utf-8; indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
def main():
from gi.repository import Gtk
dialog = Gtk.Dialog("DEBUG")
dialog.add_buttons("Close", Gtk.ResponseType.CLOSE)
dialog.run()
print("Hello World!")
dialog.destroy()
#!/bin/sh
echo "=== Clear all EFI boot entries ==="
sudo apt-get --yes install efibootmgr
sudo efibootmgr -v | grep ^Boot[0-9A-F][0-9A-F][0-9A-F][0-9A-F] | cut -c 5-8 | while read boot; do
sudo efibootmgr -v -b $boot -B
done
sudo efibootmgr -O
sudo efibootmgr -v
#!/bin/sh
find /sys -name control | grep -v debug | while read file; do
if [ "$(cat $file)" = "auto" ]; then
echo "$file is still auto."
fi
done
@fourdollars
fourdollars / unity-scale-factor.c
Created December 2, 2014 08:21
gcc -Wall -g unity-scale-factor.c `pkg-config --cflags --libs gio-2.0 xrandr x11` -lm -o unity-scale-factor
/* -*- coding: utf-8; indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- */
/**
* Copyright (C) 2014 Shih-Yuan Lee (FourDollars) <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,