Skip to content

Instantly share code, notes, and snippets.

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 October 29, 2018 23:52
Python async HTML crawling with a list of proxies
#!/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 October 14, 2017 00:13
HelvetiNews - A Minimalist Theme for HackerNews from http://www.helvetinews.com/
// ==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
#!/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 July 8, 2016 03:08
Reveal.js for MediaWiki
<!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 March 31, 2016 06:21
MediaWiki custom parser
<?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',
<!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 December 9, 2015 08:43 — forked from meiamsome/hn_search.js
HackerNews Who is Hiring TamperMonkey Script
// ==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 September 30, 2016 09:21
CUHK Network auto connection Python script
#!/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 September 25, 2016 10:21
GitHub Wiki TamperMonkey script

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: