Skip to content

Instantly share code, notes, and snippets.

@tomcarlson
tomcarlson / stackoverflow.sql
Created April 30, 2019 17:58 — forked from gousiosg/stackoverflow.sql
Script to import the stackexchange dumps into MySQL
# Copyright (c) 2013 Georgios Gousios
# MIT-licensed
create database stackoverflow DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
use stackoverflow;
create table badges (
Id INT NOT NULL PRIMARY KEY,
UserId INT,
@tomcarlson
tomcarlson / new-user
Last active January 1, 2016 01:39
Create a new user, put them in sudoer file, and give them a home directory
#create user and give him a home directory
useradd -m USERNAME
passwd USERNAME
#put user in sudoer file
sudo usermod -aG sudo <username>
#make sure user uses a bash shell, so .bashrc will work
chsh -s /bin/bash <username>
@tomcarlson
tomcarlson / setup-insight.sh
Last active January 1, 2016 03:42
Set Up Insight Node
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y python build-essential git
git config --global user.name "Tom"
git config --global user.email tom@example.com
#update npm to latest
sudo npm install npm -g
@tomcarlson
tomcarlson / new-server-setup.sh
Created December 31, 2015 00:48
Setup a new server
#!/bin/bash
STARTERDOMAIN="example.com" # name of 1st domain on this server
SERVERNAME="example" # we'll set hostname to this
ADMIN_NAME="admin" # will be set up as an admin user
ADMIN_PASS="admin password"
APACHE_VHOST="$STARTERDOMAIN" # we'll also use this for our DOMAINNAME for email, hostname -f, etc
SSLPATH="/etc/apache2/ssl"
@tomcarlson
tomcarlson / .bashrc
Last active December 30, 2015 20:52
.bashrc file to be used for new installations
export HISTSIZE=9999
export HISTFILESIZE=999999
#Have history from any terminal appended to the same history file
shopt -s histappend
#Set default creation file/directory permissions
umask u=rwx,g=rwx,o=r
# Set xterm Title
// create this file in AppData\Roaming\Sublime Text 3\Packages\User
// call it Main.sublime-menu
// this will add 'save' and 'open' commands to top menu in Sublime
[
{
"caption": "-----",
"id": "User_Settings",
},
{
"caption": "ΩOpen",
@tomcarlson
tomcarlson / Multiple Parallel Batteries along a Long Wire.ipynb
Last active August 29, 2015 14:09
Multiple Parallel Batteries along a Long Wire
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Verifying that +tomcarlson is my openname (Bitcoin username). https://onename.io/tomcarlson
@tomcarlson
tomcarlson / ban-unban.sh
Last active December 24, 2015 14:08
.bashrc functions for banning and unbanning ip addresses
# ban/unban, and look at banned ip-address using iptables
ban()
{
sudo iptables -A INPUT -s $1 -j DROP
}
unban()
{
sudo iptables -D INPUT -s $1 -j DROP
}
@tomcarlson
tomcarlson / make_self_signed_ssl.sh
Last active December 23, 2015 05:19
Bash script to create self-signed SSL Key to allow secure comms to website
# Create self-signed SSL Key to allow secure comms to website
# http://www.thegeekstuff.com/2009/07/linux-apache-mod-ssl-generate-key-csr-crt-file/
CERTIFICATE_DAYS=2000
PASSPHRASE="NO-PASS_TODAY@!"
#Certificate Parameters
SSL_DOMAIN=$1