Skip to content

Instantly share code, notes, and snippets.

@banterweb
banterweb / snippet_maker.py
Created August 7, 2016 04:44 — forked from CodyKochmann/snippet_maker.py
simple snippet maker for sublime text 3 that runs in the terminal
example_output="""
<snippet>
<content><![CDATA[Type your snippet here]]></content>
<!-- Optional: Tab trigger to activate the snippet -->
<tabTrigger>xyzzy</tabTrigger>
<!-- Optional: Scope the tab trigger will be active in -->
<scope>source.python</scope>
<!-- Optional: Description to show in the menu -->
<description>My Fancy Snippet</description>
</snippet>
@banterweb
banterweb / batch-mp4-convert-aliases.sh
Created August 7, 2016 04:44 — forked from CodyKochmann/batch-mp4-convert-aliases.sh
These are Linux based aliases that I use to batch convert different types of video files into mp4's in the background.
# convert all avi's to mp4 in nohup
alias convert-avis-to-mp4='for i in *.avi; do echo "ffmpeg -i \"${i}\" -acodec aac -b:a 128k -vcodec mpeg4 -b:v 1200k -flags +aic+mv4 \"${i}.mp4\"" ; done > batch-convert.sh ; nohup bash batch-convert.sh > batch-avi-convert.log &'
# convert all mkv's to mp4 in nohup
alias convert-mkvs-to-mp4='for i in *.mkv; do echo "ffmpeg -i \"${i}\" -vcodec mpeg4 -acodec aac \"${i}.mp4\"" ; done > batch-convert.sh ; nohup bash batch-convert.sh > batch-mkv-convert.log &'
@banterweb
banterweb / make-bootable-usb.sh.md
Created August 7, 2016 04:44 — forked from CodyKochmann/interactive-bootable-usb-setup.py
A terminal snippet that generates a bootable usb live CD on a mac to run something like ubuntu or debian.

This script is for mac users who want to throw together a bootable usb without hasling with a GUI. Most operating systems require that you take up the entire drive when you install the live CD onto the disk so I've found that this snippet does pretty much the entire job I need. For those who are inspecting the code, the $dmg_path variable is needed because for some reason macs quite often are known for sticking .dmg on the end of their generated disk images.

Note: You can get the $usb_path by using diskutil list.

iso_path="~/Downloads/ubuntu-15.10-desktop-amd64.iso" && \
usb_path="/dev/rdisk1" && \
img_path="${iso_path}.img" && \
dmg_path="${img_path}.dmg" && \
hdiutil convert -format UDRW -o $img_path $iso_path &amp;&amp; \
@banterweb
banterweb / sqlite-relational-databases.md
Created August 7, 2016 04:44 — forked from CodyKochmann/sqlite-relational-databases.md
Examples showing how SQLite relational databases are put together

SQLite Relational Database Examples

This is a example of a many to many relationship in sqlite which takes a list of people and connects them to a set of groups to efficiently store who is in which group.

CREATE TABLE users (
  u_id INTEGER PRIMARY KEY AUTOINCREMENT, 
  name TEXT
); 
CREATE TABLE groups (
@banterweb
banterweb / sql-datatypes.md
Created August 7, 2016 04:44 — forked from CodyKochmann/sql-datatypes.md
Notes on datatypes in sql to keep storage efficient.

This was a great little table written out by Bridge on stackoverflow

      Type | Maximum length
-----------+-------------------------------------
  TINYTEXT |           255 (2 8−1) bytes
      TEXT |        65,535 (216−1) bytes = 64 KiB
MEDIUMTEXT |    16,777,215 (224−1) bytes = 16 MiB
  LONGTEXT | 4,294,967,295 (232−1) bytes =  4 GiB

This is a shell snippet that runs identical ssh commands on multiple servers.

for i in node1 node2
{
  echo "running on ${i}: ${@}";
  ssh $i $@;
}

A collection of Linux commands and concepts I tend to forget

A collection of notes related to hosting

@banterweb
banterweb / wget_sitemap.sh
Created August 7, 2016 04:41 — forked from CodyKochmann/wget_sitemap.sh
wget sitemap
#!/bin/bash
# creates a sitemap with purely wget
# by: Cody Kochmann
# example usage: bash wget_sitemap.sh <sitename-1> <sitename-2> <sitename-3>
function wget_sitemap
{
# creates a sitemap of the given urls
for i in $@
do
@banterweb
banterweb / quiet-find.sh
Created August 7, 2016 04:41 — forked from CodyKochmann/quiet-find.sh
use the find command without any of the "permission denied" messages
find . ! -readable -prune