Skip to content

Instantly share code, notes, and snippets.

View simon-liu's full-sized avatar
🏠
Working from home

Zenglu Liu simon-liu

🏠
Working from home
View GitHub Profile
#!/usr/bin/env python3
import os
import time
import urllib.request
class Main:
URL = "https://www.google.com/images/branding/googleg/1x/googleg_standard_color_128dp.png"
def ping(self):
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="13">
<profile kind="CodeFormatterProfile" name="GoogleStyle" version="13">
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
set-option -g prefix C-a
bind-key C-a last-window
bind-key -n F7 next-window
unbind % # Remove default binding since we're replacing
bind | split-window -h
bind _ split-window -v
bind a send-prefix
bind C-a last-window
bind C-p previous-window
#!/bin/bash
#
# https://github.com/l-n-s/wireguard-install
#
# Copyright (c) 2018 Viktor Villainov. Released under the MIT License.
WG_CONFIG="/etc/wireguard/wg0.conf"
function get_free_udp_port
{
@simon-liu
simon-liu / painters.json
Created October 10, 2018 06:03
painters
[
"Perin del Vaga",
"Aramenta Dianthe Vail",
"Suzanne Valadon",
"Juan de Valdés Leal",
"Víctor Manuel García Valdés",
"Nina Petrovna Valetova",
"Pierre Adolphe Valette"
]
@simon-liu
simon-liu / walk-dir.py
Created September 28, 2017 01:45
python walk dir
for dirpath, dirs, files in os.walk(doc_path):
for f in files:
filename = os.path.join(dirpath, f)
print(filename)
@simon-liu
simon-liu / parser.py
Created September 28, 2017 01:44
html parser
from html.parser import HTMLParser as HTMLParserBase
class HTMLParser(HTMLParserBase):
def __init__(self, *args, **kwargs):
super(HTMLParser, self).__init__(*args, **kwargs)
self.title = ''
self.catch_title = False
self.content = ''
@simon-liu
simon-liu / cat-lines-to-file.sh
Created September 26, 2017 05:36
cat-lines-to-file
cat <<EOF >> outputfile
some lines
of text
EOF
@simon-liu
simon-liu / format-datetime.py
Created September 15, 2017 07:56
python format datetime
// '2017-09-15 15:55:25'
datetime.strftime(datetime.now(), '%Y-%m-%d %H:%M:%S')
@simon-liu
simon-liu / rsync-dirs.sh
Created September 5, 2017 05:12
rsync dirs
rsync -avrle ssh root@in-901-bj:/mnt1/squid/cache/baike /mnt1/squid/cache