Skip to content

Instantly share code, notes, and snippets.

Avatar

Chunliang Lyu cllu

View GitHub Profile
View Mount Synology basic volume.md

I want to mount a previous Synology basic volume (wasn't using RAID or SHR) to copy data to a new drive.

Plug it in the USB port doesn't work, showing (Partition 1 does not start on phyical sector boundary).

# fdisk -l
Disk /dev/sdr: 2.7 TiB, 3000558944256 bytes, 5860466688 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
@cllu
cllu / crawl.py
Created Oct 29, 2018
Python async HTML crawling with a list of proxies
View crawl.py
#!/usr/bin/env python3
from os import listdir
from os.path import isfile
from time import time, sleep
from threading import Thread, Lock
import json
import random
import asyncio
@cllu
cllu / HelvetiNews.user.js
Last active Oct 14, 2017
HelvetiNews - A Minimalist Theme for HackerNews from http://www.helvetinews.com/
View HelvetiNews.user.js
// ==UserScript==
// @name HelvetiNews
// @namespace http://tampermonkey.net/
// @version 0.2
// @description A Minimalist Theme for HackerNews
// @author dwynings
// @match https://news.ycombinator.com/*
// @downloadURL https://gist.githubusercontent.com/cllu/276fb0cd574006f4f343ef1515dac5ce/raw/HelvetiNews.user.js
// @resource styles https://gist.githubusercontent.com/cllu/276fb0cd574006f4f343ef1515dac5ce/raw/hn.css
// @grant GM_addStyle
View pdf2eps
#!/bin/bash
conversion (){
# get file name without extension, full path
b="${1%%.*}"
b=`basename $b`
full=`grealpath $1`
echo "Converting: $1 (Absolute path: $full)"
@cllu
cllu / index.html
Created Jul 8, 2016
Reveal.js for MediaWiki
View index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js – The HTML Presentation Framework</title>
<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
<meta name="author" content="Hakim El Hattab">
@cllu
cllu / CustomParser.php
Last active Mar 31, 2016
MediaWiki custom parser
View CustomParser.php
<?php
# Confirm MediaWiki environment
if (!defined('MEDIAWIKI')) die();
# Credits
$wgExtensionCredits['other'][] = array(
'name'=>'CustomParser',
'author'=>'Chunliang Lyu',
'url'=>'https://www.mediawiki.org/wiki/Extension:CustomParser',
View markdown draft-js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Draft • Decorators</title>
<link rel="stylesheet" href="../../dist/Draft.css" />
</head>
<body>
<div id="target"></div>
<script src="../../node_modules/react/dist/react.js"></script>
@cllu
cllu / hn_seach.js
Last active Dec 9, 2015 — forked from meiamsome/hn_search.js
HackerNews Who is Hiring TamperMonkey Script
View hn_seach.js
// ==UserScript==
// @name HackerNews WhosHiring
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://news.ycombinator.com/item?id=*
// @grant none
// ==/UserScript==
/* jshint -W097 */
@cllu
cllu / auto-connect-cuhk.py
Last active Sep 30, 2016
CUHK Network auto connection Python script
View auto-connect-cuhk.py
#!/usr/local/bin/python3
import requests
USER = "USER"
PASSWORD = "PASSWORD"
def login():
"""Post the login info to the CUHK authentication server"""
url = "https://securelogin.net.cuhk.edu.hk/cgi-bin/login"
@cllu
cllu / README.md
Last active Sep 25, 2016
GitHub Wiki TamperMonkey script
View README.md

GitHub Wiki TamperMonkey script

  • add word count
  • remove unused stuff
  • add Table of Content to the right column
  • Add keyboard shortcuts: double click content area to edit

The script matches only wikis on my own GitHub repos, change it according to your preferences:

You can’t perform that action at this time.