Skip to content

Instantly share code, notes, and snippets.

@semudu
semudu / sqlalchemy_dynamic_table_creation.py
Created December 13, 2020 15:21 — forked from djrobstep/sqlalchemy_dynamic_table_creation.py
SQLAlchemy ORM code to create SQL tables from a dynamically defined column list
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from sqlalchemy import Column, MetaData, Table, create_engine
from sqlalchemy import String, Integer, Float, BigInteger, DateTime
from sqlalchemy.schema import DropTable, CreateTable
from sqlalchemy.orm import scoped_session, sessionmaker
BOX_NAME=vagrant-build
BASE_DIR="`pwd`/machines"
BOX_DIR="${BASE_DIR}/${BOX_NAME}"
mkdir -p ${BASE_DIR}
VBoxManage createvm --name "${BOX_NAME}" --ostype RedHat_64 --basefolder ${BASE_DIR}
VBoxManage registervm "${BOX_DIR}/${BOX_NAME}.vbox"
mkdir -p tmp
@semudu
semudu / git.migrate
Created April 3, 2019 07:23 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
gpg --version # Check GPG installation
git --version # Check Git installation
git-secret --version # Check git-secret installation
gpg --list-keys # Make sure that your GPG key is listed here
git init # Initialize the repository if you have not done it already
git secret init # Initialize the repository using git-secret
git secret tell [email protected] # Add a user
git secret whoknows # Get a list of which users are attached on the repo
git secret add file.txt # Add a file on the encryption list
@semudu
semudu / gitflow-breakdown.md
Created May 18, 2018 05:18 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@semudu
semudu / install-kafka.txt
Last active April 4, 2018 20:30 — forked from jarrad/install-kafka.txt
Install Kafka on OSX via Homebrew
$> brew cask install java
$> brew install kafka
$> vim ~/bin/kafka
# ~/bin/kafka
#!/bin/bash
zkServer start
kafka-server-start.sh /usr/local/etc/kafka/server.properties
@semudu
semudu / pivot_twice.sql
Created January 26, 2017 11:27
pivot twice
SELECT STATIC_FIELD,
MAX (X),
MAX (A),
MAX (Y),
MAX (B),
MAX (Z),
MAX (C)
FROM (SELECT *
FROM (SELECT *
FROM (SELECT STATIC_FIELD,
#make user admin
sudo gitlab-rails console
u = User.find_by_username("maneesh")
u.admin = true
u.save
exit
:pserver:[email protected]:/usr/public/developers/POS
CVSROOT=:pserver:[email protected]:/usr/public/developers/POS cvs login
git cvsimport -v -a -d :pserver:[email protected]:/usr/public/developers/POS GeniusOpenPOS
@semudu
semudu / howto-filemerge-git-osx.md
Created December 25, 2015 18:55 — forked from bkeating/howto-filemerge-git-osx.md
HOWTO: Using FileMerge (opendiff) with Git on OSX

HOWTO: Using FileMerge (opendiff) with Git on OSX

FileMerge (opendiff) can really come in handy when you need to visually compare merging conflicts. Other times it's just a nice visual way to review your days work.

The following method works by creating a simple bash script (git-diff-cmd.sh) that sets us up with the proper command line arguments for Git to pass off files to FileMerge.