Skip to content

Instantly share code, notes, and snippets.

@luanjunyi
luanjunyi / gist:dac67062b80f7327fdfda403fad8d20b
Last active July 7, 2023 20:01
Disable double click to fullscreen in Youtube (user script)
// ==UserScript==
// @name Disable full screen api in Youtube
// @namespace http://tampermonkey.net/
// @version 1.0
// @description When wathcing Youtube, double click won't enable fullscreen mode.
// @author luanjunyi@gmail.com
// @match https://www.youtube.com/watch*
// @icon https://www.google.com/s2/favicons?sz=64&domain=hibbard.eu
// @grant none
// ==/UserScript==
@luanjunyi
luanjunyi / async http request
Last active January 10, 2021 17:01
Load testing a HTTP server with asyncio. Help Parler to test their own infra
import aiohttp
import asyncio
import sys
import random
async def fetch(session, url, task_id):
user_agent = 'MAGA 2020, American First Observer %d' % random.randint(1, 111000)
headers = {
'User-Agent': user_agent
}
@luanjunyi
luanjunyi / snake_camel_convert
Created October 2, 2018 18:33
Camel/Snake case convert
#! /bin/bash
name=$1
if [[ "$name" =~ [A-Z] ]]; then
# convert camel case to snake case
echo $name | sed -r 's/([A-Z])/_\L\1/g' | sed 's/^_//g'
else
# convert snake case to camel case
echo $name | sed -r 's|_([a-z])|\U\1|g'
echo $name | sed -r 's|_([a-z])|\U\1|g' | sed 's|^\([a-z]\)|\u\1|'
@luanjunyi
luanjunyi / Kaggle sklearn competition solution.ipynb
Created June 6, 2014 04:12
Kaggle sklearn competition solution(ipython notebook)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@luanjunyi
luanjunyi / ipython_config.py
Created February 18, 2014 05:27
ipython config from coderpad.io
# Configuration file for ipython.
c = get_config()
#------------------------------------------------------------------------------
# InteractiveShellApp configuration
#------------------------------------------------------------------------------
# A Mixin for applications that start InteractiveShell instances.
#
@luanjunyi
luanjunyi / cn-domains
Created July 19, 2013 01:33
Chinese domains
.sanguosha.com
.07073.com
.10010.com
.114la.com
.115.com
.123cha.com
.126.net
.127.net
.13580.com
.159.com
@luanjunyi
luanjunyi / .gitconfig
Created May 26, 2013 03:32
My ~/.gitconfig
[user]
name = Jerry Luan
email = luanjunyi@gmail.com
[credential]
helper = osxkeychain
[alias]
ci = commit
co = checkout
br = branch
st = status