Skip to content

Instantly share code, notes, and snippets.

View suhanlee's full-sized avatar
:octocat:
Focusing

kyle suhanlee

:octocat:
Focusing
View GitHub Profile
@suhanlee
suhanlee / gcm-send-curl.py
Last active February 26, 2016 06:35
Simple GCM Send Script
#!/usr/bin/env python
import os
API_KEY='API_KEY'
DEVICE_TOKENS = 'DEVICE_TOKEN'
MESSAGES = "messages"
command_string = "curl https://android.googleapis.com/gcm/send" \
" -H 'Content-Type: application/json'" \
" -H 'Authorization: key=" + API_KEY + "'" \
@suhanlee
suhanlee / get_version_code.rb
Created February 17, 2016 07:38
get version-code and version-name in android's build.grade
#!/usr/bin/env ruby
filename = ARGV[0]
File.open(filename, 'r').each do |line|
versionCode = line.match(/versionCode\s(\d*)/)
if versionCode != nil
v = versionCode.captures
puts v
end
end
@suhanlee
suhanlee / regex.swift
Created April 15, 2016 05:18
regular expression swift example
class Regex {
let internalExpression: NSRegularExpression?
let pattern: String
init(_ pattern: String) {
self.pattern = pattern
do {
self.internalExpression = try NSRegularExpression(pattern: pattern, options: .CaseInsensitive)
} catch {
self.internalExpression = nil
@suhanlee
suhanlee / Procfile
Last active June 13, 2016 06:01
Flask basic app deploy for heroku
web: gunicorn app:app
@suhanlee
suhanlee / get frame count
Last active August 9, 2016 08:03
ffmpeg command line
$ ffprobe -select_streams v -show_streams -count_frames [input file]
$ ffmpeg -i [input_file]
# fps * duration_time
@suhanlee
suhanlee / call url.java
Last active June 20, 2016 20:40
Instagram-android
Intent insta_intent = getPackageManager().getLaunchIntentForPackage("com.instagram.android");
insta_intent.setComponent(new ComponentName("com.instagram.android", "com.instagram.android.activity.UrlHandlerActivity"));
insta_intent.setData(Uri.parse("https://www.instagram.com/explore/tags/tech/")); // 해시태그 주소 넣기
startActivity(insta_intent);
@suhanlee
suhanlee / cmd_line
Created June 24, 2016 08:04
Imagemagick
$ convert [Input_file] [output_file]
# convert input.mp4 output.gif
# "Can't verify CSRF token authenticity" for json format
class ApplicationController < ActionController::Base
protect_from_forgery with: :null_session, only: Proc.new { |c| c.request.format.json? }
end
@suhanlee
suhanlee / hash key
Created July 4, 2016 17:52
Social Login
# google plus login
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v
# facebook login
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
@suhanlee
suhanlee / pg backups.sh
Last active July 20, 2016 07:24
heroku pg backup script
# check pg backup schedules
$ heroku pg:backups schedules
# unschedule
$ heroku pg:backups unschedule DATABASE_URL
# download backup file
$ curl -o latest.dump `heroku pg:backups public-url`
# restore db-backup-file