Skip to content

Instantly share code, notes, and snippets.

View SilverRainZ's full-sized avatar
🤒
Out sick

Shengyu Zhang SilverRainZ

🤒
Out sick
View GitHub Profile
@yougg
yougg / proxy.md
Last active October 10, 2025 06:51
complete ways to set http/socks/ssh proxy environment variables

set http or socks proxy environment variables

# set http proxy
export http_proxy=http://PROXYHOST:PROXYPORT

# set http proxy with user and password
export http_proxy=http://USERNAME:PASSWORD@PROXYHOST:PROXYPORT

# set http proxy with user and password (with special characters)
@cpba
cpba / im.srain.Srain.json
Last active February 22, 2018 15:52
flatpak manifest for Srain
{
"app-id": "im.srain.Srain",
"runtime": "org.gnome.Platform",
"runtime-version": "3.26",
"sdk": "org.gnome.Sdk",
"command": "srain",
"rename-desktop-file": "Srain.desktop",
"rename-icon": "srain",
"finish-args": [
"--device=all",
@roadrunner2
roadrunner2 / 0 Linux-On-MBP-Late-2016.md
Last active November 3, 2025 04:13
Linux on MacBook Pro Late 2016 and Mid 2017 (with Touchbar)

Introduction

This is about documenting getting Linux running on the late 2016 and mid 2017 MPB's; the focus is mostly on the MacBookPro13,3 and MacBookPro14,3 (15inch models), but I try to make it relevant and provide information for MacBookPro13,1, MacBookPro13,2, MacBookPro14,1, and MacBookPro14,2 (13inch models) too. I'm currently using Fedora 27, but most the things should be valid for other recent distros even if the details differ. The kernel version is 4.14.x (after latest update).

The state of linux on the MBP (with particular focus on MacBookPro13,2) is also being tracked on https://github.com/Dunedan/mbp-2016-linux . And for Ubuntu users there are a couple tutorials (here and here) focused on that distro and the MacBook.

Note: For those who have followed these instructions ealier, and in particular for those who have had problems with the custom DSDT, modifying the DSDT is not necessary anymore - se

@ZWindL
ZWindL / .color_coded
Created December 13, 2016 03:27
Srain's color coded config file
-fcolor-diagnostics
-isystem/usr/include/c++/6.2.1/
-isystem/usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/include
-I./inc
-pthread
-I/usr/include/gtk-3.0
-I/usr/include/at-spi2-atk/2.0
-I/usr/include/at-spi-2.0
-I/usr/include/dbus-1.0
-I/usr/lib/dbus-1.0/include
@r0l1
r0l1 / copy.go
Last active August 3, 2025 11:39
Copy a directory tree (preserving permissions) in Go.
/* MIT License
*
* Copyright (c) 2017 Roland Singer [roland.singer@desertbit.com]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@MaskRay
MaskRay / termite-preload.c
Created May 7, 2016 07:50
LD_PRELOAD termite to support filesystem:https:// style URL patterns
// Add support for filesystem+https:// style URL
// url_regex.hh scheme:// -> (scheme:)+//
// gcc preload.c -ldl -fPIC -shared -o preload.so
// LD_PRELOAD=./preload.so /usr/bin/termite
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
#include <assert.h>
#include <dlfcn.h>
@MaskRay
MaskRay / a.py
Last active April 15, 2016 06:39
pwn: Arch Linux gcc-multilib 5.3.0-5 gcc vul_prog.c -o a (x86-64)
#!/usr/bin/env python3
# http://www.cis.syr.edu/~wedu/seed/Labs_12.04/Software/Format_String/files/vul_prog.c x86-64
import pty, os, re, struct, subprocess, sys
def readuntil(f, delim):
data = b''
while not (data.endswith(delim) if type(delim) == bytes else delim.search(data)):
c = f.read(1)
data += c
if not c:
@hexchain
hexchain / 51-noto-color-emoji.conf.xml
Last active September 3, 2025 06:55
Emoji on Linux desktop. Use with aur/cairo-coloredemoji.
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/conf.avail/51-noto-color-emoji.conf -->
<fontconfig>
<selectfont>
<acceptfont>
<pattern>
<patelt name="family"><string>Noto Color Emoji</string></patelt>
</pattern>
</acceptfont>
@MaskRay
MaskRay / a.js
Last active March 15, 2016 05:59
新浪AlphaGo对李世乭文字直播desktop notification
文字直播,网页载入后,打开devtools(一般是F12),在Console里输入一行js,即可获取通知。若弹出对话框提示Allow notification?选Allow。
http://bn.sina.cn/video/live/index/tech/alphago?vt=4 人机围棋大战
Notification.requestPermission(function() { $('section').on('DOMSubtreeModified', function() { var n = new Notification('meow', {body: $('section .chat_item p').eq(0).text().trim()}); setTimeout(function() { n.close() }, 10000) }) })
http://lives.sina.cn/live/live?live_mg=sports&wm=&livetype=qipai&stype=&vt=4&match_id=l_142874 李世石VS谷歌AlphaGo 人机大战III
http://lives.sina.cn/live/live?live_mg=sports&wm=&livetype=qipai&stype=&vt=4&match_id=l_142961 李世石VS谷歌AlphaGo 人机大战Ⅳ
http://lives.sina.cn/live/live?live_mg=sports&wm=&livetype=qipai&stype=&vt=4&match_id=l_143040 李世石VS谷歌AlphaGo 人机大战V
var orig_increment_apply_do = window.increment_apply_do; window.increment_apply_do = function(rs) { Notification.requestPermission(function() { var n = new Notification('meow', {body: rs.data[0].content}); setTimeout(function() { n.close() }, 10000) }); return orig_increment_apply_do(rs)
@cezarguimaraes
cezarguimaraes / console.lua
Created January 16, 2016 16:56
Interactive console for Lua 5.1
--[[
Usage:
-- Start a console instance, holds its own environment
local console = InteractiveConsole {
sum = function(a, b)
return a + b
end
}
-- First call: define output and error functions