Skip to content

Instantly share code, notes, and snippets.

View stanwu's full-sized avatar

Stan Ht. Wu stanwu

View GitHub Profile
@stanwu
stanwu / clean_gradle.sh
Created September 29, 2020 07:42
Clean up your gradle
#!/bin/bash
echo "Before:"
du -h -d 0 .gradle
find ~/.gradle -type f -atime +30 -delete
find ~/.gradle -type d -mindepth 1 -empty -delete
echo "Now:"
du -h -d 0 .gradle
@stanwu
stanwu / telnet.py
Last active September 27, 2020 15:03
python telnet example
import getpass
import telnetlib
#
# Please remove line 8, 10 if use for HTTP port 80 only
# class telnetlib.Telnet(host=None, port=0[, timeout])
#
HOST = "localhost"
user = input("Enter your remote account: ")
@stanwu
stanwu / de.py
Created September 9, 2020 14:45
Full Code Example (decode)
from cryptography.fernet import Fernet
def load_key():
"""
Load the previously generated key
"""
return open("secret.key", "rb").read()
def decrypt_message(encrypted_message):
"""
@stanwu
stanwu / en.py
Created September 9, 2020 14:43
Full Code Example (encode)
from cryptography.fernet import Fernet
def generate_key():
"""
Generates a key and save it into a file
"""
key = Fernet.generate_key()
with open("secret.key", "wb") as key_file:
key_file.write(key)
#!/bin/bash
for i in `cat dingding.txt`
do
ip=`nslookup $i | grep Address | grep -v 8.8.8.8 | awk '{print $2}'`
echo $i
echo $ip
done
@stanwu
stanwu / .screenrc
Created September 3, 2017 07:03 — forked from onsails/.screenrc
My .screenrc
# GNU Screen configuration file
#
# Balaji S. Srinivasan <balajis_at_stanford_dot_edu>
# This file can be found at http://jinome.stanford.edu/stat366/unix/.screenrc
# Modified to play well with emacs, by moving Ctrl-A to Ctrl-T
# Modification of original files by Sven Guckes, Sarunas Vancevicius, and Mike Perry
# Sarunas Vancevicius original: http://www.redbrick.dcu.ie/~svan/configs/screenrc
# Mike Perry original: http://fscked.org/writings/225notes/unix/.screenrc

JSI Tip 0470 - How to launch a program before the shell (Explorer) starts.

Mar 27, 1998 Jerold Schulman In tip 074, I explained how to change the Shell for selected users.

Using the same technique, you can launch an application before the Shell, so as to avoid any interaction with it.

Leaving the Shell as Explorer.exe, edit:

@stanwu
stanwu / git-wars.md
Last active August 12, 2017 00:16 — forked from juderosen/git-wars.md
Git Wars: GitHub vs Bitbucket

Git Battle: GitHub vs Bitbucket 2017

Introduction

Now, you might think the answer I'm going to give you is already obvious because I'm using GiHub right now, but it's not. Both GitHub and Bitbucket offer great Git services, but each has its own features and pricing plans. In the following... thing, I'm going to compare the two and then offer a final solution that should work for most people.

Use GitHub for open source and public repos (you'll spend most of your time here) and Bitbucket for private repos. But, sign up for GitHub first, then import account into Bitbucket. Also, check comments for updates. P.S. I personally prefer GitHub.

Interface and Functionality

@stanwu
stanwu / permissions.txt
Created July 25, 2017 05:01 — forked from Arinerron/permissions.txt
A list of all Android permissions...
android.permission.ACCESS_ALL_DOWNLOADS
android.permission.ACCESS_BLUETOOTH_SHARE
android.permission.ACCESS_CACHE_FILESYSTEM
android.permission.ACCESS_CHECKIN_PROPERTIES
android.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY
android.permission.ACCESS_DOWNLOAD_MANAGER
android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED
android.permission.ACCESS_DRM_CERTIFICATES
android.permission.ACCESS_EPHEMERAL_APPS
android.permission.ACCESS_FM_RADIO