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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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' |
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
// | |
// +--------------------+-----------------------+----------------+----------------+ |
These are some simple bash functions and scripts for making CSV/TSV files prettier on the command line
see http://stefaanlippens.net/pretty-csv.html for more information.
OlderNewer