Skip to content

Instantly share code, notes, and snippets.

View alichtman's full-sized avatar
🏡
$HOME

Aaron Lichtman alichtman

🏡
$HOME
View GitHub Profile
@vmarkovtsev
vmarkovtsev / identifier_split.py
Created May 26, 2017 10:39
Identifier splitting algorithm from the paper "Topic modeling of public repositories at scale using names in source code"
import re
NAME_BREAKUP_RE = re.compile(r"[^a-zA-Z]+")
def extract_names(token):
token = token.strip()
prev_p = [""]
def ret(name):
r = name.lower()
if len(name) >= 3:
@echuber2
echuber2 / hidetimes1.sh
Last active March 24, 2019 19:41
Lifting bash commands for safety
# https://gist.github.com/echuber2/2b44d229bc7282a8839d506af2bddbfa
# Try source-ing this file first to disable the bash "times" command
# hidetimes1.sh
alias times=''
unalias times
lifted_times () {
@ianklatzco
ianklatzco / catfact.py
Last active September 5, 2019 12:30
send cat facts to your friends logged into a ews/server. netid = username if you're not from uiuc
# if netid is logged in, send a random cat fact to all of its terminals.
# usage: crontab -e. paste in:
# 0 * * * * python ~/catfact.py
# logs in ~/victims.txt
# why did i spend so much time on this.
# this got me banned from the school servers for two days
messagechance = 5 # 1 is 1%, 99 is 99%. keep in mind this will only run if they're logged in.
postscript = '\n this has been an automated cat fact. contact me to unsubscribe. or to subscribe others.\n'
listofnetids = ['netids','go','here']

Cheatsheet

Move cursor

command description
ctrl+a Move cursor to the start of the line
ctrl+e Move cursor to the end of the line
or ctrl+b Move cursor back one character
▶ or ctrl+f Move cursor forward one character
@a-paxton
a-paxton / text-cleaning+word2vec-gensim.py
Created September 11, 2015 23:31
Cleaning Text Data and Creating 'word2vec' Model with Gensim
# preliminaries
from pymongo import MongoClient
from nltk.corpus import stopwords
from string import ascii_lowercase
import pandas as pd
import gensim, os, re, pymongo, itertools, nltk, snowballstemmer
# set the location where we'll save our model
savefolder = '/data'
@philipptempel
philipptempel / HOWTO.mac-set-file-icon.md
Last active January 5, 2023 17:44
How to set an icon for a file type on Mac?

Q: How to set an icon for some file types throughout the whole system?

For example, I have text files that ends with .scala extension and I want to associate an icon for that files through the whole system and for any newly created file of this extension.

Gisted from http://superuser.com/questions/178316/how-to-set-an-icon-for-a-file-type-on-mac

All credits go to the author of the accepted and top-voted answer by Daniel Beck

A: How to set an icon for a file type on Mac!

@viliampucik
viliampucik / pythonstartup.py
Created January 11, 2021 22:02
XDG compliant ~/.python_history
# Store interactive Python shell history in ~/.cache/python_history
# instead of ~/.python_history.
#
# Create the following .config/pythonstartup.py file
# and export its path using PYTHONSTARTUP environment variable:
#
# export PYTHONSTARTUP="${XDG_CONFIG_HOME:-$HOME/.config}/pythonstartup.py"
import atexit
import os
@hawkins
hawkins / screen.js
Created January 16, 2017 06:22
Node.js blessed screen - keep your output separate from your input!
/*
* I've used blessed to create a textbox at the bottom line in the screen.
* The rest of the screen is the 'body' where your code output will be added.
* This way, when you type input, your program won't muddle it with output.
*
* To try this code:
* - $ npm install blessed --save
* - $ node screen.js
*
* Key points here are:
@AndiDittrich
AndiDittrich / AesUtil.js
Last active January 7, 2024 03:47
Node.js - AES Encryption/Decryption with AES-256-GCM using random Initialization Vector + Salt
// SPDX-License-Identifier: MPL-2.0
// AES Encryption/Decryption with AES-256-GCM using random Initialization Vector + Salt
// ----------------------------------------------------------------------------------------
// the encrypted datablock is base64 encoded for easy data exchange.
// if you have the option to store data binary save consider to remove the encoding to reduce storage size
// ----------------------------------------------------------------------------------------
// format of encrypted data - used by this example. not an official format
//
// +--------------------+-----------------------+----------------+----------------+
@soxofaan
soxofaan / README.md
Last active January 19, 2024 17:48
Simple pretty CSV and TSV file viewer.