Skip to content

Instantly share code, notes, and snippets.

@z3oc
z3oc / Firefox.MSEdge.smoothscroll
Created June 7, 2019 02:00
Firefox -> MS Edge flavor smooth scroll
general.smoothScroll.msdPhysics.continuousMotionMaxDeltaMS;250
general.smoothScroll.msdPhysics.enabled;true
general.smoothScroll.msdPhysics.motionBeginSpringConstant;450
general.smoothScroll.msdPhysics.regularSpringConstant;450
general.smoothScroll.msdPhysics.slowdownMinDeltaMS;50
@z3oc
z3oc / crackmusic163.py
Created December 26, 2017 04:21
Convert cache from .uc! to .mp3 @ music.163.com
'''
Description: convert cache from music.163.com to mp3
Usage: python3 crackmusic163.py sourcefile [...]
Output: cache files converted to mp3 in current directory
'''
def crack163Cache(srcfile):
dstfile = srcfile.rstrip('uc!') + 'mp3'
with open(srcfile, 'rb') as f1, open(dstfile,'xb') as f2:
data = bytearray(f1.read())
for i in range(len(data)):
@z3oc
z3oc / .vimrc
Last active February 3, 2018 19:18
my .vimrc
"******* Chong's vimrc *******"
" true color
set termguicolors
" No Vi
set nocompatible
" auto read file changed from outside
set autoread
@z3oc
z3oc / linux_list.h
Created January 2, 2017 14:51
Userspace implementation of kernel doubly linked list
/*
source: https://www.cs.uic.edu/~hnagaraj/articles/linked-list/
*/
#ifndef _LINUX_LIST_H
#define _LINUX_LIST_H
/*
* These are non-NULL pointers that will result in page faults
* under normal circumstances, used to verify that nobody uses
@z3oc
z3oc / jdk_informsystem.sh
Created December 3, 2016 09:05
shell script to inform system about new JDK on openSUSE
# source: https://en.opensuse.org/SDB:Installing_Java
# download jdk tar.gz, extract and move to /usr/lib64 and
# replace jdk versions manually in this script
# (after execution run update-alternatives)
#!/bin/bash
sudo gzip $(readlink -f /usr/lib64/jdk1.8.0_111/man/man1/java.1)
sudo gzip $(readlink -f /usr/lib64/jdk1.8.0_111/man/man1/keytool.1)
sudo gzip $(readlink -f /usr/lib64/jdk1.8.0_111/man/man1/orbd.1)
sudo gzip $(readlink -f /usr/lib64/jdk1.8.0_111/man/man1/policytool.1)
@z3oc
z3oc / calcgpa.py
Created October 27, 2016 15:00
Calc GPA from txt
import sys
file = open(sys.argv[1])
gradetotal = 0
pointtotal = 0
def calcGPA(grade,point,method):
global gradetotal
global pointtotal
if method == "HUST":