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
# USAGE: python Letter_Permutations.py <string here> | |
# Do not put spaces between multiple words in the string | |
import argparse | |
import math | |
# Reads word from argument | |
parser = argparse.ArgumentParser() | |
parser.add_argument('word', help = "Word to count combinations for") | |
args = parser.parse_args() |
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
#!/bin/bash | |
if [ $# -ne 2 ] | |
then | |
if [ "$1" != "run" ] | |
then | |
echo "Usage: $0 <world to backup> <world to unpack>" | |
echo "For best results, run with sudo." | |
exit | |
else | |
java -Xms256M -Xmx496M -jar -XX:MaxPermSize=128M /home/pi/SpigotMC/spigot.jar nogui |
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
#!/bin/bash | |
cp -rf ~/Library/Application\ Support/minecraft/screenshots ~/Desktop/ |
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
#!/usr/bin/env python | |
import os, sys, subprocess, time | |
import filecmp as fc | |
# -------------------------------------------------------------------------------------------------------- | |
# Backport of Python 2.7's subprocess.check_output function from https://gist.github.com/edufelipe/1027906 | |
def check_output(*popenargs, **kwargs): | |
r"""Run command with arguments and return its output as a byte string. | |
Backported from Python 2.7 as it's implemented as pure python on stdlib. |
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
# Goes in /etc/init/ | |
description "Blah server" | |
start on startup | |
start on filesystem and started networking | |
stop on shutdown | |
respawn | |
chdir /home/username/folder |
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
# Goes in /etc/nginx/conf.d/ | |
upstream quibbler { | |
server 127.0.0.1:3000; | |
} | |
server { | |
listen 0.0.0.0:80; | |
server_name quibbler.co www.quibbler.co; |
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
def majority_element(a): | |
n = len(a) | |
if n == 1: | |
return a[0] | |
if n == 0: | |
return None | |
k = n/2 | |
elem1 = majority_element(a[:k]) | |
elem2 = majority_element(a[k+1:]) |
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 random | |
import math | |
# Configure paths to your dataset files here | |
DATASET_FILE = 'data.csv' | |
FILE_TRAIN = 'train.csv' | |
FILE_VALID = 'validation.csv' | |
FILE_TESTS = 'test.csv' | |
# Set to true if you want to copy first line from main |
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
declare -a arr=("google.com" "facebook.com" | |
"amazon.com" "yahoo.com" "flickr.com" | |
"youtube.com" "twitter.com" "reddit.com") # etc etc | |
for i in "${arr[@]}" | |
do | |
echo "$i" | |
curl -L --silent "$i" | grep -E "hiring|jobs" | |
# Maybe even look for easter eggs this way! | |
done |
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 csv | |
from collections import Counter | |
have_tally = {} | |
want_tally = {} | |
# Get the dataset at insights.stackoverflow.com/survey | |
path_to_datum = '/path/to/downloaded/developer_survey_2019/survey_results_public.csv' | |
# This *should* work without too much modification with SO survey datasets from other |
OlderNewer