Skip to content

Instantly share code, notes, and snippets.

View goz's full-sized avatar
🐌
I may be slow to respond.

goz goz

🐌
I may be slow to respond.
View GitHub Profile
@goz
goz / mysql_to_big_query.sh
Created March 14, 2018 08:35 — forked from shantanuo/mysql_to_big_query.sh
Copy MySQL table to big query. If you need to copy all tables, use the loop given at the end. Exit with error code 3 if blob or text columns are found. The csv files are first copied to google cloud before being imported to big query.
#!/bin/sh
TABLE_SCHEMA=$1
TABLE_NAME=$2
mytime=`date '+%y%m%d%H%M'`
hostname=`hostname | tr 'A-Z' 'a-z'`
file_prefix="trimax$TABLE_NAME$mytime$TABLE_SCHEMA"
bucket_name=$file_prefix
splitat="4000000000"
bulkfiles=200

Keybase proof

I hereby claim:

  • I am gozali on github.
  • I am gozali (https://keybase.io/gozali) on keybase.
  • I have a public key whose fingerprint is 94BA E3F1 CBEA F50C 5FE6 51FB 2CF1 B2B0 AEA6 C6A9

To claim this, I am signing this object:

namespace :docker do
desc "Run tasks in parallel using docker"
task :test do
forks = 4
begin
# Start docker containers (serially, docker seems to have problems with concurrency)
ports = {}
forks.times do |i|
# Start redis and get the mapped port
`docker run -d -p 6379 -name redis#{i} yourdockeruser/redis`
var express = require('express')
, mongoskin = require('mongoskin')
var app = express()
app.use(express.bodyParser())
var db = mongoskin.db('localhost:27017/test', {safe:true});
app.param('collectionName', function(req, res, next, collectionName){
req.collection = db.collection(collectionName)
@goz
goz / blackberry_push.rb
Created June 17, 2011 11:53
Blackberry Push Messsages
require 'net/http'
require 'net/https'
require 'uri'
require 'rubygems'
require 'restclient'
DELIVERY_METHOD = 'unconfirmed'
BOUNDARY = 'fghjkklllmnggddcvjjkkm'
def push_message(pin, content, app_id, app_password, app_port)
@goz
goz / navigation_result.json
Created April 7, 2011 19:13
navigation result.json
{
"access_token": "2:zoe-scNB_mjnIOkh:HPBpDT3WzCEle48m",
"location": {
"accuracy": 1068.0,
"address": {
"city": "Depok",
"country": "Indonesia",
"country_code": "ID",
"region": "West Java",
"street": "Jalan Raya Sawangan"
@goz
goz / navigation.rb
Created April 7, 2011 19:13
navigation without GPS using ruby
require 'json'
require 'httparty'
cell_towers = [{:location_area_code => '10001',
:mobile_network_code => '01',
:cell_id => '4390',
:mobile_country_code => '501'}]
param = {
:cell_towers => cell_towers,
@goz
goz / metaprogramming.rb
Created April 7, 2011 19:11
basic ruby metaprogramming
class Array
def remove(*args)
string_params = ""
args.each do |arg_item|
string_params += arg_item
end
flatten.collect { |k| k.delete string_params}
end
def repeat(int)
<?php foreach(range('A','Z') as $i) echo $i; ?>
<div class="alphabet">
<% ("A".."Z").each do |alpha| %>
<li><%= link_to alpha, some_url %></li>
<% end %>
</div>