Skip to content

Instantly share code, notes, and snippets.

@CNBorn
CNBorn / miya_pro_functional_rows.json
Created April 14, 2021 02:51
Miya Pro - Enable functional rows without mode switch using Fn+PageDn - Karabiner Complex modifications configuration
{
"title": "Ducky X Varmilo Miya Pro - Enable functional rows without mode switch using Fn+PageDn",
"rules": [
{
"description": "Fn + = increases the volume",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "equal_sign",
@CNBorn
CNBorn / alembic_revision_fix.sh
Last active January 4, 2017 16:25
Bash Script that automatically fix your alembic revision conflicts
#!/bin/bash
set -e
BRANCH_NAME=$(git symbolic-ref -q --short HEAD)
MIGRATION_FILE=$(git diff --name-only $BRANCH_NAME $(git merge-base $BRANCH_NAME integration) | grep migrations)
MIGRATION_FILE_COUNT=$(echo $MIGRATION_FILE | awk '{print NF}')
if [[ $MIGRATION_FILE_COUNT -gt 1 ]]; then
printf '\033[93mcurrent branch $BRANCH_NAME has more than one migration file! exiting. \033[0m\n'
#encoding: utf-8
import xml.etree.ElementTree as ET
tree = ET.parse('angkorwat.xml')
root = tree.getroot()
list_title = []
list_image = []
list_image_author = []
list_image_copyright_sign = []
@CNBorn
CNBorn / gist:3405246
Created August 20, 2012 15:41
homebrew:mysql_install_db results
cnborn@brahma ~$ mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
@CNBorn
CNBorn / gist:3404994
Created August 20, 2012 15:03
brew:mysql installation completed.
==> Pouring mysql-5.5.25a.snowleopard.bottle.tar.gz
==> Caveats
Set up databases to run AS YOUR USER ACCOUNT with:
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
To set up base tables in another folder, or use a different user to run
mysqld, view the help for mysqld_install_db:
mysql_install_db --help
@CNBorn
CNBorn / gist:3404200
Created August 20, 2012 13:46
completely remove ports from your mac
port installed #list all installed
sudo port uninstall XXXX
#backup your MySQL databases
sudo port uninstall XXXX
port install # uninstall until it shows nothing
#ab -n 100000 http://127.0.0.1:8880/hello/world
#You have to run Sentry at 127.0.0.1:8000 and replace the following DSN.
from bottle import route, run
@route('/hello/:name')
def index(name='World'):
from raven import Client
client = Client('http://48ca560b5e2b4fe8b8802ed29c54de81:8abfd206af87410d84fd7b8670731e9c@127.0.0.1:8000/2')
client.captureMessage('hello world!')
@CNBorn
CNBorn / testboy.rb
Created September 12, 2011 03:29
Ruby Testboy
#!/usr/local/bin/ruby
require 'net/smtp'
##########################################
#Ruby Testboy - Runs Django Test for you
#
# If there are any unitest failed, testboy will send out the error messages immediately
# to the recipients you set below.
#
#SETUP:
#!/usr/bin/env bash
# A bash Script to migrate Sqlite3 DB when Django Model Schema changes.
# It will only migrate tables whose Schema unchanged.
# cp this script to your Django Project Directory,
# then run as sqlitemig.sh yoursqlitedbname.db
# Written by CNBorn[%]hotmail.com
#echo $1
if test ! -f "$1"