Skip to content

Instantly share code, notes, and snippets.

View DeviaVir's full-sized avatar
🏴‍☠️

Chase DeviaVir

🏴‍☠️
View GitHub Profile
@DeviaVir
DeviaVir / findNum.py
Last active April 14, 2017 10:43
quick and dirty method of finding squares in a resolution
num = 0
bound = float(7560)
divider = float(1920)
while(True):
num += 1
checkNum = (bound / num)
wholeNum = (divider / checkNum)
print('%s / %s = %s' % (divider, checkNum, wholeNum))
if float(wholeNum).is_integer() and float(checkNum).is_integer():
@DeviaVir
DeviaVir / mysql-cluster.service
Created March 7, 2017 09:23
MySQL Cluster systemd service
[Unit]
Description=MySQL Cluster server
After=network.target auditd.service
[Service]
ExecStart=/opt/mysql/server-5.7/bin/ndb_mgmd -f /var/lib/mysql-cluster/config.ini
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
@DeviaVir
DeviaVir / debian-docker-engine-install.sh
Created January 20, 2017 11:45
Musings while trying to install docker engine
# following steps from https://docs.docker.com/engine/installation/linux/debian/#/install-using-the-repository
$ sudo apt-get update
[...]
Err https://apt.dockerproject.org jessie/main amd64 Packages
HttpError403
Get:59 https://apt.dockerproject.org jessie/testing amd64 Packages [454 B]
Err https://apt.dockerproject.org jessie/testing amd64 Packages
HttpError403
Get:60 https://apt.dockerproject.org jessie/main Translation-en_US [454 B]
@DeviaVir
DeviaVir / palindrome.py
Created July 29, 2016 11:32
Detect word palindromes
import sys
from Queue import Queue
class Solution:
def __init__(self,):
self.stack = []
self.queue = Queue()
def pushCharacter(self, ch):
self.stack.append(ch)
var Cylon = require('cylon'),
after = require('after');
Cylon.robot({
connections: {
crazyflie: { adaptor: 'crazyflie', port: 'radio://1/10/250KPS' }
},
devices: {
drone: { driver: 'crazyflie' }
wget https://raw.githubusercontent.com/DeviaVir/asg_persistence/master/attach_volume.py
python attach_volume.py --tag Name --value cb-production --attach_as /dev/sdf
mkdir -p /data/db/
mount /dev/xvdf /data/db
if [ $? -eq 0 ]; then
echo 'Using existing drive'
else
mkfs -t ext4 /dev/xvdf
mount /dev/xvdf /data/db
fi

Install the yubikey personnalization tool via Homebrew

brew install ykpers

Install the GPG suite on your machine

Plug in your key and active the GPG compatible mode

$ ykpersonalize -m86
#!/bin/bash
echo "kill gpg-agent"
code=0
while [ 1 -ne $code ]; do
killall gpg-agent
code=$?
sleep 1
done
pinentry-program /usr/local/MacGPG2/libexec/pinentry-mac.app/Contents/MacOS/pinentry-mac
default-cache-ttl 600
max-cache-ttl 7200
enable-ssh-support
write-env-file
resource "aws_iam_user" "asg_healthreport" {
name = "${var.stack}-asg_healthreport"
# can't use create_before_destroy due to fixed name
}
resource "aws_iam_access_key" "asg_healthreport" {
user = "${aws_iam_user.asg_healthreport.name}"
# can't use create_before_destroy due to fixed name of user
}