Skip to content

Instantly share code, notes, and snippets.

View dbanetto's full-sized avatar
🐦

David Barnett dbanetto

🐦
View GitHub Profile
@dbanetto
dbanetto / tic-tac-toe.cpp
Created January 1, 2012 04:25
Tic Tac Toe
#include <iostream>
#include <string>
using namespace std;
//defines
#define tablehieght 3
#define tablewidth 3
#define player1 -32
@dbanetto
dbanetto / version.xml
Created February 20, 2012 06:10
An example of the .xml file that RSS-updater reads
<?xml version="1.0" encoding="UTF-8" ?>
<xml>
<ver>1.0.0.0</ver>
<app>Updater</app>
<loc>NULL</loc>
</xml>
import random
#Edit for player list
players = [ "Lukos", "david", "elf_and_safety", "jack" , "sefirosu" , "supa_kappa" , "Nantres", "orange_lightning" ]
#Hardcode people to be in a team like so:
dire = ["Blake"]
rad = ["Daniel"]
#debug
#print (len(dire) , len(rad))
@dbanetto
dbanetto / binarystring
Created May 18, 2014 02:05
Solves : encoding/decoding two binary strings together into one binary string
#!/usr/bin/python3
def main():
print (decode(encode("101" , "1011")))
print (decode(encode("1101" , "1011")))
print (decode(encode("10010101" , "1011")))
# Reads read the source C
# Decodes by getting the 1st 2 bits from the string
# 1st bit (from left) is the End of String bit
#!/usr/bin/env python3
#
# Requires Python 3, and requests
#
# Tested on Linux, python 3.4, requests 2.6.0
#
import requests
import json, time, datetime, re
@dbanetto
dbanetto / tmx
Last active December 5, 2015 10:49
#!/bin/bash
#
# Modified TMUX start script from:
# http://forums.gentoo.org/viewtopic-t-836006-start-0.html
#
# Store it to `~/bin/tmx` and issue `chmod +x`.
#
# Works because bash automatically trims by assigning to variables and by
@dbanetto
dbanetto / README.md
Last active April 23, 2018 08:50
Systemd service to lazily start postgres when you need it

Lazy Postgres

A systemd service to activate postgresql only when you need it

Install

requires: Postgresql and Systemd

  • create postgresql.socket into /usr/lib/systemd/system
  • run sudo systemctl enable postgresql.socket to enable the socket service
@dbanetto
dbanetto / zshenv
Created October 23, 2016 04:49
zshenv for cargo/rustup in ~/.local/share
if (( SHLVL > 1 )); then
return 1
fi
export RUST_SRC_PATH=~/.local/share/rustup/toolchains/<triple for sys>/lib/rustlib/src/rust/src
export CARGO_HOME=~/.local/share/cargo
export RUSTUP_HOME=~/.local/share/rustup
@dbanetto
dbanetto / cargo-binupdate.sh
Created October 23, 2016 05:13
cargo command to update all installed executables
#!/bin/sh
cargo install --list | grep ':$' | sed 's/\(^.*\)\s.*/\1/' | xargs -t -I _ cargo install _
# install script into $PATH
# use via `cargo binupdate`
# also accepts `cargo binupdate --force`
FROM python:3.8-alpine
RUN apk add --no-cache --virtual builddeps gcc musl-dev && \
pip --no-cache-dir install aws-sam-cli && \
apk del builddeps