Skip to content

Instantly share code, notes, and snippets.

Avatar

Xiuyu Li nickleefly

View GitHub Profile
@nickleefly
nickleefly / stock.py
Created Mar 9, 2021
fetch yahoo finance data
View stock.py
from yahoofinancials import YahooFinancials
import pprint
import ssl
try:
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
# Legacy Python that doesn't verify HTTPS certificates by default
pass
else:
View eventemitter.js
class MyEventEmitter {
constructor() {
this._events = {};
}
on(name, listener) {
if (!this._events[name]) {
this._events[name] = [];
}
@nickleefly
nickleefly / acme.md
Last active Dec 8, 2020
shadowsocks v2ray-plugin nginx with docker-compose
View acme.md
export CF_Key="sdfsdfsdfljlbjkljlkjsdfoiwje"
export CF_Email="xxxx@sss.com"
~/.acme.sh/acme.sh --issue -d 'example.com' -d '*.example.com' --dns dns_cf -k ec-256
~/.acme.sh/acme.sh --issue --dns dns_cf -d subdomain.example.com
@nickleefly
nickleefly / Freenode IRC.md
Created May 21, 2019 — forked from yeyewangwang/Freenode IRC.md
Freenode Nickserv Commands
View Freenode IRC.md

Freenode IRC

Connect

/server chat.freenode.net

Nick

@nickleefly
nickleefly / google-play.md
Last active Jan 10, 2019
从服务器检索信息时出错 [DF-DFERH-01]
View google-play.md

login to openwrt ssh

sed -i '$a conf-dir=/etc/dnsmasq.d' /etc/dnsmasq.conf
mkdir /etc/dnsmasq.d/
cat >>/etc/dnsmasq.d/custom.conf<<EOF
address=/services.googleapis.cn/216.58.197.195
EOF

restart dnsmasq

@nickleefly
nickleefly / command.sh
Last active Dec 19, 2018
nginx google ngx_http_google_filter_module
View command.sh
# create nginx user
sudo adduser --system --home /nonexistent --shell /bin/false --no-create-home --disabled-login --disabled-password --gecos "nginx user" --group nginx
sudo chown nginx:nginx /var/log/nginx/access.log /var/log/nginx/error.log
# check if neccesary files exist
cat /etc/systemd/system/multi-user.target.wants/nginx.service
cat /etc/logrotate.d/nginx
cat /etc/init.d/nginx
ls -l /etc/nginx/
@nickleefly
nickleefly / karabiner.json
Last active May 14, 2019
karabiner elements ~/.config/karabiner/karabiner.json
View karabiner.json
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@nickleefly
nickleefly / README.md
Created Dec 20, 2017 — forked from jamesramsay/README.md
Gmail: delete old emails automatically
View README.md

Gmail: delete old emails automatically

Automatically deletes old emails that match the specified label.

Get started

  • Create a new Google Apps Script at https://script.google.com
  • Overwrite the placeholder with the javascript below
  • Update the following constants:
    • LABEL_TO_DELETE: the label that should be have old messages deleted
@nickleefly
nickleefly / npx-osx.md
Created Dec 10, 2017 — forked from tamzinblake/npx-osx.md
How to get npx shell auto fallback working on OSX bash
View npx-osx.md

OSX ships with bash 3 by default, but you need bash 4 to use npx shell auto fallback. Using homebrew:

(instructions borrowed from https://github.com/Homebrew/homebrew-command-not-found)

brew update && brew install bash
# Add the new shell to the list of allowed shells
sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells'
# Change to the new shell
chsh -s /usr/local/bin/bash
@nickleefly
nickleefly / initialize_basic_user.yml
Created Sep 11, 2017
ansible playbook setup user
View initialize_basic_user.yml
---
- hosts: linode
remote_user: root
vars:
NORMAL_USER_NAME: 'yourusername'
tasks:
- name: Make sure we have a 'wheel' group
group:
name: wheel
state: present