Skip to content

Instantly share code, notes, and snippets.

View hankchanocd's full-sized avatar
😈
Mobilize the world with AI

Hank Chan hankchanocd

😈
Mobilize the world with AI
View GitHub Profile
@fkztw
fkztw / korean_fish.py
Last active May 10, 2019 06:18
Yet another chatbot
#!/usr/bin/env python3
import itertools
whats = [
'自經區', '自貿區',
'摩天輪', '愛情摩天輪', '愛情產業鏈',
'發大財', '愛河的水甘甘', '選總統',
'迪士尼',
@Aidurber
Aidurber / cleanup.sh
Last active September 29, 2022 13:14
A handy script to clean up a mac thanks to - Gant Laborde's article: https://medium.freecodecamp.org/how-to-free-up-space-on-your-developer-mac-f542f66ddfb
# Cleanup old node_modules
echo "Cleaning node_modules in projects older than 30 days"
find . -name "node_modules" -type d -mtime +30 | xargs rm -rf
echo "Done cleaning node_modules"
# Clean up homebrew
echo "Clean homebrew"
brew update && brew upgrade && brew cleanup
echo "Done cleaning homebrew"
@tobywf
tobywf / clean_old_lambda_versions.py
Last active April 11, 2024 06:52
A quick script to remove old AWS Lambda function versions
from __future__ import absolute_import, print_function, unicode_literals
import boto3
def clean_old_lambda_versions():
client = boto3.client('lambda')
functions = client.list_functions()['Functions']
for function in functions:
versions = client.list_versions_by_function(FunctionName=function['FunctionArn'])['Versions']
for version in versions:
@dersam
dersam / gitkraken.zsh
Last active March 10, 2024 09:39
Open GitKraken using the current repo directory in the cli.
## Open GitKraken using the current repo directory.
## For when you want a prettier view of your current repo,
## but prefer staying in the cli for most things.
## This will break if GitKraken ever removes the -p flag.
## If you're not using OSX, the path is definitely different.
kraken () {
~/Applications/GitKraken.app/Contents/MacOS/GitKraken -p $(pwd)
}
@hugobowne
hugobowne / tweet_listener.py
Last active October 6, 2023 18:48
NOTE: this code is for a previous version of the Twitter API and I will not be updating in the near future. If someone else would like to, I'd welcome that! Feel free to ping me. END NOTE. Here I define a Tweet listener that creates a file called 'tweets.txt', collects streaming tweets as .jsons and writes them to the file 'tweets.txt'; once 100…
class MyStreamListener(tweepy.StreamListener):
def __init__(self, api=None):
super(MyStreamListener, self).__init__()
self.num_tweets = 0
self.file = open("tweets.txt", "w")
def on_status(self, status):
tweet = status._json
self.file.write( json.dumps(tweet) + '\n' )
self.num_tweets += 1
@waldofe
waldofe / .gitconfig
Last active March 29, 2020 22:27
git plog
[alias]
plog = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
@bcoe
bcoe / npm-top.md
Last active March 23, 2024 20:02
npm-top.md

npm Users By Downloads (git.io/npm-top)


npm users sorted by the monthly downloads of their modules, for the range May 6, 2018 until Jun 6, 2018.

Metrics are calculated using top-npm-users.

# User Downloads

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
@jaibeee
jaibeee / brew-perms.sh
Last active February 15, 2024 22:49
Configure homebrew permissions to allow multiple users on MAC OSX. Any user from the admin group will be able to manage the homebrew and cask installation on the machine.
#!/bin/sh
# Configure homebrew permissions to allow multiple users on MAC OSX.
# Any user from the admin group will be able to manage the homebrew and cask installation on the machine.
# allow admins to manage homebrew's local install directory
chgrp -R admin /usr/local
chmod -R g+w /usr/local
# allow admins to homebrew's local cache of formulae and source files
chgrp -R admin /Library/Caches/Homebrew
@karpathy
karpathy / min-char-rnn.py
Last active May 1, 2024 11:00
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)