Skip to content

Instantly share code, notes, and snippets.

View lilydjwg's full-sized avatar
🙃
dissappointed about the new UI and round avatars

依云 lilydjwg

🙃
dissappointed about the new UI and round avatars
View GitHub Profile
@tianyuf
tianyuf / baidu-as-a-network-utility.css
Created May 14, 2016 15:03
BaaN: Baidu as a Network Utility - 百度的实用主义方法论.
@-moz-document domain("baidu.com") {
body {
display: none;
}
html {
margin: 30px;
}
html::after {
@thorsten
thorsten / setUserAgent.js
Created May 9, 2016 15:12
Override user agent on all browsers
function setUserAgent(window, userAgent) {
// Works on Firefox, Chrome, Opera and IE9+
if (navigator.__defineGetter__) {
navigator.__defineGetter__('userAgent', function () {
return userAgent;
});
} else if (Object.defineProperty) {
Object.defineProperty(navigator, 'userAgent', {
get: function () {
return userAgent;
@hotoo
hotoo / commonjs-gf.vim
Last active August 9, 2019 12:58
gf to open commonjs files
" http://usevim.com/2013/01/04/vim101-jumping/
function! InitJavaScript()
setl suffixesadd+=.js
setl isfname+=@-@
let node_modules = finddir('node_modules', expand('%:p:h') . ';')
exec "setl path+=". node_modules
"let project_root=findfile('package.json', expand('%:p:h') . ';')
"exec "setl path+=". fnamemodify(project_root, ':p:h') . "/node_modules"
endfunction
@Tblue
Tblue / mozlz4a.py
Last active April 19, 2025 08:52
MozLz4a compression/decompression utility
#!/usr/bin/env python3
# vim: sw=4 ts=4 et tw=100 cc=+1
#
####################################################################################################
# DESCRIPTION #
####################################################################################################
#
# Decompressor/compressor for files in Mozilla's "mozLz4" format. Firefox uses this file format to
# compress e. g. bookmark backups (*.jsonlz4).
#
@saikocat
saikocat / qemu_usage_with_spice_cp.md
Last active January 4, 2021 10:27
QEMU + Spice with Copy & Paste

Create a runner shell script in host -> init with:

  • 2GB RAM
  • Host CPU with 2 Cores
  • Localhost port 2222 traffic redirect to guest port 22
  • Spice display with copy and paste enabled
#!/bin/sh
SPICE_PORT=5924
SPARK_IMG=/home/hoa/spark-training.qcow2
#!/usr/bin/env python3
#
# Dumb script to dump (some) of bcache status
# Copyright 2013 Darrick J. Wong. All rights reserved.
#
# This file is part of Bcache. Bcache 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
@klzgrad
klzgrad / 00-README.txt
Last active December 14, 2024 10:10
DNS compression pointer mutation
$ LD_PRELOAD=$PWD/sendmsg.so dig twitter.com @8.8.8.8
;; Warning: Message parser reports malformed message packet. <-- malformed 因为把压缩指针当作域名一部分了
;; Question section mismatch: got twitter.com/RESERVED0/CLASS256
; <<>> DiG 9.9.5-3-Ubuntu <<>> twitter.com @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44722
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1
import Data.List
-- 第一行照写,第二行开头加空格反写;如果不够一行,前面加空格填充
arrange :: Int -> String -> [String]
arrange n str
| n == 1 = [str]
| length str <= n = [str]
| length str <= (2*n-1) = [take n str,replicate (2*n-1 - length str) ' ' ++ reverse (drop n str) ++ " "]
| otherwise = arrange n (take (2*n-1) str) ++ arrange n (drop (2*n-1) str)
@XVilka
XVilka / TrueColour.md
Last active April 22, 2025 06:32
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@bertspaan
bertspaan / README.md
Created January 2, 2014 15:28
Python script to convert DBF database file to CSV