Skip to content

Instantly share code, notes, and snippets.

View makeittotop's full-sized avatar

abhishek pareek makeittotop

  • Canada
  • 23:06 (UTC -07:00)
View GitHub Profile
@makeittotop
makeittotop / goog_cloud_storage_upload_to_bucket.py
Last active August 29, 2015 14:17
Uploads the latest version of a file on google nearline based on the timestamp
#!/usr/bin/env python
import boto
import gcs_oauth2_boto_plugin
import os, sys, glob
# URI scheme for Google Cloud Storage.
GOOGLE_STORAGE = 'gs'
# URI scheme for accessing local files.
LOCAL_FILE = 'file'
@makeittotop
makeittotop / goog_cloud_storage_list_bucket_contents.py
Created March 23, 2015 12:47
List a google nearline bucket contents
#!/usr/bin/env python
import boto
import gcs_oauth2_boto_plugin
import os, sys, glob
# URI scheme for Google Cloud Storage.
GOOGLE_STORAGE = 'gs'
# URI scheme for accessing local files.
LOCAL_FILE = 'file'
@makeittotop
makeittotop / select_example.go
Created March 23, 2015 14:23
select function and signal handling in a single threaded go code
package main
import (
"fmt"
"time"
"os"
"os/signal"
"syscall"
)
@makeittotop
makeittotop / free_space.go
Last active August 29, 2015 14:17
Go script to calculate free space on a machine
package main
import (
"syscall"
"os"
"fmt"
"math"
)
func main() {
@makeittotop
makeittotop / non_blocking_example.go
Last active August 29, 2015 14:17
go non blocking example
package main
import "fmt"
func main() {
messages := make(chan string)
signals := make(chan bool)
select {
case msg := <-messages:
@makeittotop
makeittotop / closure.go
Created March 23, 2015 14:56
go closure example
// from gobyexample.com
package main
import "fmt"
// This function `intSeq` returns another function, which
// we define anonymously in the body of `intSeq`. The
// returned function _closes over_ the variable `i` to
// form a closure.
@makeittotop
makeittotop / rack_sample.rb
Created March 23, 2015 16:29
A simple rack web server running on port 7777
# sample rack_app.rb
require 'rack'
app = Proc.new do |env|
['200', {'Content-Type' => 'text/html'}, ['A barebones rack app.']]
end
Rack::Handler::WEBrick.run app, :Port => 7777
@makeittotop
makeittotop / jenkins_recent_build_status.sh
Last active August 29, 2015 14:17
This tiny little gist queries status of most recent build for all jobs through the Jenkins cli
# query jenkins CLI to get the status of most recent build for all jobs
for job in `java -jar ~/Downloads/jenkins-cli.jar -s http://localhost:8080/ list-jobs 2> /dev/null`; do echo "Project: '$job' recent build status:"; java -jar ~/Downloads/jenkins-cli.jar -s http://localhost:8080/ console $job -f -n 1 2> /dev/null; done
Example run :-
unix> ...
Project: 'copy-dev-dir-to-nas' recent build status:
Finished: SUCCESS
Project: 'disk-space-usage-fox-script' recent build status:
Finished: SUCCESS
@makeittotop
makeittotop / jenkins_cli.sh
Created March 24, 2015 16:30
jenkins cli
abhishek@bjlinux068 ~> java -jar ~/Downloads/jenkins-cli.jar -s http://localhost:8080/ list-jobs 2> /dev/null
copy-dev-dir-to-nas
disk-space-usage-fox-script
disk-space-usage-fox-tractor-host
disk-space-usage-lic-tractor-host
inventory-db-backup
render-space-usage-fox
tactic-db-backup
upload-inventory-db-dump-to-goog-nearline
upload-inventory-db-dump-to-s3
@makeittotop
makeittotop / create_new_virt_net_interface.sh
Created March 26, 2015 13:48
Creates a new virtual network interface on linux
# Add a static route to a server on a separate lan
# duplicate
route add -net 172.17.0.0 netmask 255.255.255.0 gw 172.16.15.246
route
netstat -rn
# setup a virtual network interfece here
ifconfig eth0:0 123.123.22.22