Skip to content

Instantly share code, notes, and snippets.

View scvnc's full-sized avatar

Vincent Schramer scvnc

View GitHub Profile
@m-aciek
m-aciek / check.py
Created May 10, 2019 22:00
Alembic database freshness check.
from alembic import config
from alembic import script
from alembic.runtime import migration
import sqlalchemy
import exceptions
engine = sqlalchemy.create_engine(DATABASE_URL)
alembic_cfg = config.Config('alembic.ini')
@kokumura
kokumura / lineinfile.sh
Created May 25, 2018 08:39
lineinfile in Shell Script
# Ansible 'lineinfile' like function in Shell Script.
# Works on both Bash and Zsh.
function lineinfile(){
if [[ $# != 3 ]];then
local THIS_FUNC_NAME="${funcstack[1]-}${FUNCNAME[0]-}"
echo "$THIS_FUNC_NAME - 3 arguments are expected. given $#. args=[$@]" >&2
echo "usage: $THIS_FUNC_NAME PATTERN LINE FILE" >&2
return 1
fi
@nickfox-taterli
nickfox-taterli / upgrade_raspbian_to_buster.sh
Last active August 11, 2020 21:57
Upgrade Raspbian To Buster
sudo sync
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo sed -i 's/jessie/buster/g' /etc/apt/sources.list
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo sync
#sudo reboot
@frgomes
frgomes / install-docker.sh
Last active June 6, 2021 18:52
Debian - install docker in Debian Jessie
#!/bin/bash
# compiled from https://docs.docker.com/engine/installation/linux/debian/#/debian-jessie-80-64-bit
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get install apt-transport-https ca-certificates -y
sudo sh -c "echo deb https://apt.dockerproject.org/repo debian-jessie main > /etc/apt/sources.list.d/docker.list"
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
@mariodian
mariodian / openbazaar.service
Created August 31, 2016 17:10
Debian Systemd OpenBazaar Service
# Save as /lib/systemd/system/openbazaar.service
[Unit]
Description=OpenBazaar server
After=network.target auditd.service
[Service]
Type=forking
User=pi
Group=pi
PIDFile=/tmp/openbazaard.pid
@scvnc
scvnc / Windows-USB-on-Linux.md
Last active August 2, 2016 02:23
Bootable Windows 7 USB Drive via LINUX

PROBLEM: ALL MY WINDOWS IMAGES ARE ON MY LINUX WORKSTATION AND I NEED TO BOOT WINDOWS OFF A USB DRIVE.

Historically, I've used Windows 7 USB/DVD Download tool on a Windows guest OS in VirtualBox to get this done. Well after doing the research and several stick formats later: I've pieced together a better recipe.

Some other solutions/tutorials have some shortcomings. WinUSB is too complicated and doesn't work with certain versions of GRUB. This post comes very close but assumes the drive has a Windows 7 bootloader already.

Make new partition table

Give the USB device one primary partition. This is what I did, other partitioning schemes may work. I'm using fdisk.

@scy
scy / opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md
Last active June 10, 2024 09:43
Opening and closing an SSH tunnel in a shell script the smart way

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost

@wildlyinaccurate
wildlyinaccurate / event.js
Last active February 12, 2021 01:05
Really simple Javascript custom event system
var Event = function() {
var self = this;
self.queue = {};
self.fired = [];
return {
fire: function(event) {
@brodul
brodul / streaming.sh
Created July 25, 2012 19:39
Twitch.tv script for streaming
#! /bin/bash
# originaly from http://tinyurl.com/twitch-linux from taladan
# www.youtube.com/user/taladan
# gist created by brodul
INRES="1280x800" # input resolution
#OUTRES="1024x640" # Output resolution
OUTRES="800x500" # Output resolution
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active June 5, 2024 22:16 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.