Skip to content

Instantly share code, notes, and snippets.

View c0ze's full-sized avatar
🏠
Working from home

Arda Karaduman c0ze

🏠
Working from home
View GitHub Profile
@c0ze
c0ze / deploy.sh
Created December 15, 2014 05:18
Deploy static version of Rails site to S3 bucket
#!/bin/bash
# This script generates a static version of your rails site
# and uploads it into specified S3 bucket
# in this case the site had only two static pages, index.html and dashboard.html
# you need to configure these in routes.rb
# PS: if you know any other cleaner way to do this, pls let me know.
# this is necessary for setting up rbenv/rvm
source /Users/coze/.bash_profile
### Keybase proof
I hereby claim:
* I am c0ze on github.
* I am coze (https://keybase.io/coze) on keybase.
* I have a public key whose fingerprint is 1E59 A9C5 7D0A A2FF E48F DF72 13BC 8AE4 E958 D3CC
To claim this, I am signing this object:
@c0ze
c0ze / gist:a21e98018299b51b275c
Created June 30, 2015 06:49
A gist to unzip photos packed by google takeout and put them into folders by date
require 'zip'
file_path = ARGV[0]
Zip::ZipFile.open(file_path) { |zip_file|
zip_file.each { |f|
date = f.name.split("/")[2].split(" ")[0]
name = f.name.split("/")[3]
p "date #{date} name #{name}"
f_path=File.join("GooglePhotos", date.split("-"), name)
@c0ze
c0ze / jekyll-s3.rake
Last active April 4, 2020 13:53
deploys a jekyll site to s3 bucket. you must provide aws credentials in .env. Aws sdk v2 compatible. contains optional minifier and gzip.
require "aws-sdk"
require "dotenv"
require "reduce"
Dotenv.load
def local_dir; './_site'; end
def access_key; ENV['AWS_ACCESS_KEY']; end
def secret_key; ENV['AWS_SECRET_KEY']; end
#!/bin/bash
# Eddystone Scan by Arda Karaduman
# Based on ibeacon_scan by radius networks
# http://stackoverflow.com/questions/21733228/can-raspberrypi-with-ble-dongle-detect-ibeacons
if [[ $1 == "parse" ]]; then
packet=""
capturing=""
count=0
while read line
@c0ze
c0ze / ibeacon_scan.sh
Created December 25, 2015 10:24
A bash script to parse ibeacon packets
#!/bin/bash
# iBeacon Scan by Arda Karaduman
function parse_ib_uuid {
UUID=`echo $1 | sed 's/^.\{69\}\(.\{47\}\).*$/\1/'`
UUID=`echo $UUID | sed -e 's/\ //g' -e 's/^\(.\{8\}\)\(.\{4\}\)\(.\{4\}\)\(.\{4\}\)\(.\{12\}\)$/\1-\2-\3-\4-\5/'`
}
function parse_ib_major {
MAJOR=`echo $1 | sed 's/^.\{117\}\(.\{5\}\).*$/\1/'`
@c0ze
c0ze / replace.sh
Created March 18, 2016 08:57
Recursive replace string in directory
find `pwd` -iname "*.go" -type f -exec sed -i '' 's:github.com/alecthomas/log4go:github.com/sujrd/log4go:g' {} +
@c0ze
c0ze / build.sh
Created April 10, 2016 11:39
shell script to compile a web/chrome app made with coffee-script / slim
TARGETDIR="./out"
rm -rf $TARGETDIR
# copy html
for file in $(find . -type f -name \*.html); do
dir="./$TARGETDIR/$(dirname ${file})"
mkdir -p "$dir"
cp $file "$dir/$(basename ${file%.*}).html"
@c0ze
c0ze / phash_deps.sh
Created April 22, 2016 02:28
phash dependencies for rasbian
sudo apt-get install libsndfile1 libsndfile1-dev libsamplerate0 libsamplerate0-dev libmpg123-0 libmpg123-dev cimg-dev
cat ./* | grep ALLIANZ | awk '{print $9}' | sed 's/,//g' | awk '{s+=$1}END{print s}'