Skip to content

Instantly share code, notes, and snippets.

View zhiyue's full-sized avatar
🌻
just do it.

zhiyue zhiyue

🌻
just do it.
View GitHub Profile
@zhiyue
zhiyue / anyconnect_gui.scpt
Created March 6, 2020 10:12 — forked from e11s/anyconnect_gui.scpt
Cisco AnyConnect VPN GUI client connection automation (with Keychain)
-- 1. Create a new generic password entry in Keychain Access called "WHATEVER_AnyConnect_VPN" (the name in Keychain access must match that in line 39 below) with your password for the Cisco AnyConnect VPN server.
-- 2. Modify values of vpnUrl and keychainKey variables
-- 3. Open this script in Script Editor (both this and the above are in the Applications->Utilities folder) and "Save as.." an Application (.app) with desired name.
-- 4. Open Security & Privacy System Preferences, go to Privacy, Accessibility.
-- 5. Enable the above .app so it can access Accessibility
-- 6. Copy and paste a nice icon on the generic Applescript icon (I used a copy of the default AnyConnect one)
-- 7. Add the new .app to /Users/[yourshortname]/Applications with a shortcut to your Dock
-- 8. Enjoy the fast connection with no need to enter password and increased security of not having a sensitive password stored as plain text
-- 9. Run script again to close connection
@zhiyue
zhiyue / ufw.md
Created February 8, 2020 14:00 — forked from kimus/ufw.md
NAT and FORWARD with Ubuntu’s ufw firewall

UFW

I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.

Install UFW

if ufw is not installed by default be sure to install it first.

@zhiyue
zhiyue / readme.md
Created January 25, 2020 14:46 — forked from KrustyHack/readme.md
Proxmox Cloud VM

[[qm_cloud_init]] Cloud-Init Support

ifdef::wiki[] :pve-toplevel: endif::wiki[]

http://cloudinit.readthedocs.io[Cloud-Init] is the defacto multi-distribution package that handles early initialization of a virtual machine instance. Using Cloud-Init, configuration of network

@zhiyue
zhiyue / readme.md
Created January 25, 2020 14:46 — forked from KrustyHack/readme.md
Proxmox Cloud VM

[[qm_cloud_init]] Cloud-Init Support

ifdef::wiki[] :pve-toplevel: endif::wiki[]

http://cloudinit.readthedocs.io[Cloud-Init] is the defacto multi-distribution package that handles early initialization of a virtual machine instance. Using Cloud-Init, configuration of network

@zhiyue
zhiyue / gist:40ded98ccb39a72a4ae7fa7bc6abb07c
Created January 19, 2020 18:03 — forked from pawelmhm/gist:8917867
Scrapy spider crawling Stack Overflow
from scrapy.spider import Spider
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import Selector
from scrapy.item import Item, Field
import urllib
class Question(Item):
tags = Field()
answers = Field()
////////////////////////////////////////////////////////////////////////////////
// This is an example of a proposed configuration language for restic,
// based on Hashpicorp's HCL.
//
// The main feature of the grammar in this example are:
//
// - More than one repository can be defined in a single configuration file.
// - Some aspects of the configuration (i.e. backends definitions) can be
// shared by different repositories.
// - Support for multiple backends for a single repository.
////////////////////////////////////////////////////////////////////////////////
// This is an example of a proposed configuration language for restic,
// based on Hashpicorp's HCL.
//
// The main feature of the grammar in this example are:
//
// - More than one repository can be defined in a single configuration file.
// - Some aspects of the configuration (i.e. backends definitions) can be
// shared by different repositories.
// - Support for multiple backends for a single repository.
@zhiyue
zhiyue / IntelliJ_IDEA__Perf_Tuning.txt
Created January 2, 2020 10:27 — forked from P7h/IntelliJ_IDEA__Perf_Tuning.txt
Performance tuning parameters for IntelliJ IDEA. Add these params in idea64.exe.vmoptions or idea.exe.vmoptions file in IntelliJ IDEA. If you are using JDK 8.x, please knock off PermSize and MaxPermSize parameters from the tuning configuration.
-server
-Xms2048m
-Xmx2048m
-XX:NewSize=512m
-XX:MaxNewSize=512m
-XX:PermSize=512m
-XX:MaxPermSize=512m
-XX:+UseParNewGC
-XX:ParallelGCThreads=4
-XX:MaxTenuringThreshold=1
@zhiyue
zhiyue / IntelliJ_IDEA__Perf_Tuning.txt
Created January 2, 2020 10:27 — forked from P7h/IntelliJ_IDEA__Perf_Tuning.txt
Performance tuning parameters for IntelliJ IDEA. Add these params in idea64.exe.vmoptions or idea.exe.vmoptions file in IntelliJ IDEA. If you are using JDK 8.x, please knock off PermSize and MaxPermSize parameters from the tuning configuration.
-server
-Xms2048m
-Xmx2048m
-XX:NewSize=512m
-XX:MaxNewSize=512m
-XX:PermSize=512m
-XX:MaxPermSize=512m
-XX:+UseParNewGC
-XX:ParallelGCThreads=4
-XX:MaxTenuringThreshold=1
@zhiyue
zhiyue / data_loader.py
Created December 19, 2019 09:58 — forked from kevinzakka/data_loader.py
Train, Validation and Test Split for torchvision Datasets
"""
Create train, valid, test iterators for CIFAR-10 [1].
Easily extended to MNIST, CIFAR-100 and Imagenet.
[1]: https://discuss.pytorch.org/t/feedback-on-pytorch-for-kaggle-competitions/2252/4
"""
import torch
import numpy as np