Skip to content

Instantly share code, notes, and snippets.

View timuckun's full-sized avatar

Tim Uckun timuckun

  • Lantel Integrated Solutions
  • New Zealand
View GitHub Profile
@intotecho
intotecho / A MySQL Table to BigQuery Import Script.md
Last active July 29, 2022 04:37 — forked from shantanuo/mysql_to_big_query.sh
Copy MySQL table to big query.

Import a MySQL Table or Database to a BigQuery Schema.

Usage:

~/bin/mysql_table_to_big_query.sh bucket_name schema_name table_name ~/bin/mysql_schema_to_big_query.sh bucket_name [schema_name].

Description

@thegauraw
thegauraw / clone_gitlab_projects.rb
Last active May 28, 2020 20:14
How to clone all the repositories or projects from gitlab?
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
# TWO WAYS TO RUN THIS SCRIPT:
# ----------------------------
# --->>> THE FIRST WAY> Run this script as executable: `./clone_gitlab_projects.rb`
# You need to make the script executable: `chmod +x gitlab_clone_all_repos.rb`
# ---- ANYTHING ABOVE THIS LINE IS ONLY REQUIRED IF YOU WANT TO RUN THE SCRIPT WITH SINGLE COMMAND `./clone_gitlab_projects.rb` ---- #
@aanari
aanari / batch_update.sql
Last active May 26, 2017 02:23
PG Batch Update
CREATE EXTENSION IF NOT EXISTS "dblink";
CREATE OR REPLACE FUNCTION batch_update(TEXT) RETURNS INTEGER LANGUAGE plpgsql AS $$
DECLARE
batch_query TEXT := '';
row_limit INTEGER := (REGEXP_MATCHES($1, 'LIMIT (\d+)', 'i'))[1];
row_count INTEGER := 1;
row_offset INTEGER := 0;
total_rows INTEGER := 0;
connection_str TEXT := 'dbname=' || CURRENT_DATABASE();
@bbonamin
bbonamin / Gemfile
Created November 27, 2013 19:15
Bundler with multiple gemfiles. If your Gemfile becomes too big, you might want to split it.
source 'https://rubygems.org'
gemfiles = [ 'Gemfile1', 'Gemfile2' ]
gemfiles.each do |gemfile|
instance_eval File.read(gemfile)
end
@btbytes
btbytes / base36_encode_decode.sql
Created October 25, 2013 18:53
Base36 Conversion in PostgreSQL
-- source: http://www.jamiebegin.com/base36-conversion-in-postgresql/
CREATE OR REPLACE FUNCTION base36_encode(IN digits bigint, IN min_width int = 0)
RETURNS varchar AS $$
DECLARE
chars char[];
ret varchar;
val bigint;
BEGIN
chars := ARRAY['0','1','2','3','4','5','6','7','8','9'
,'A','B','C','D','E','F','G','H','I','J','K','L','M'