Skip to content

Instantly share code, notes, and snippets.

@khris
khris / gist:9801921
Last active August 29, 2015 13:57
Hack ActionBar
View decorView = getWindow().getDecorView();
int actionBarViewId = decorView.getContext().getResources().getIdentifier("android:id/action_bar", null, null);
View actionBarView = getWindow().getDecorView().findViewById(actionBarViewId);
actionBarView.setClickable(true);
actionBarView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(v.getContext(), "ActionBar is clicked", Toast.LENGTH_LONG).show();
}
});
@khris
khris / conf.py.dist
Created May 11, 2014 13:40
Simple Twitter bot
OAUTH_TOKEN = '<YOUR ACCESS TOKEN>'
OAUTH_SECRET = '<YOUR ACCESS TOKEN SECRET>'
CONSUMER_KEY = '<YOUR API KEY>'
CONSUMER_SECRET = '<YOUR API SECRET>'
# seconds
INTERVAL = 30
@khris
khris / AndroidManifest.xml
Created June 25, 2014 06:54
Insecure link handling with `TextView`
<?xml version="1.0" encoding="utf-8"?>
<manifest
...
package="net.tekhnokracy.intentredirect.app"
... >
<application ... >
<activity
android:name="net.tekhnokracy.intentredirect.app.DummyActivity"
android:exported="false" >
<intent-filter>
@khris
khris / gist:f05dc3d3275ae5e8c7ae
Created October 8, 2014 09:57
Set a field name in a MongoDB document with dollar sign($)
db.application.update(
{field1: 'value1'},
{$set: {'subdoc.$field_name_with_dollar_sign': 'value2'}}
)

Keybase proof

I hereby claim:

  • I am khris on github.
  • I am khris (https://keybase.io/khris) on keybase.
  • I have a public key whose fingerprint is BE0A 44C6 B37C 3B23 A891 785E E006 1B23 A3B1 BD0F

To claim this, I am signing this object:

@khris
khris / kaist_chan.html
Last active August 29, 2015 14:10
넙죽이 머리 그리기 http://jsfiddle.net/khris/0goy12pL/
<!DOCTYPE html>
<html>
<head lang="ko">
<meta charset="UTF-8">
<title>넙죽이</title>
<script type="text/javascript">
function draw() {
var canvas = document.getElementById('kaist_chan');
var ctx = canvas.getContext('2d');
ctx.fillStyle = 'rgba(22, 160, 220, 1)';
@khris
khris / gist:2910153
Created June 11, 2012 13:45
fucking php gettext with js for gedit3
d=window.get_active_document();s,e=d.get_selection_bounds();t=d.get_text(s,e,True);d.delete_selection(False,False);d.insert_at_cursor(''.join(("<?=_('",t,"')?>")))
/**
*
* It's under MPL 1.1
* See http://www.mozilla.org/MPL/1.1/
* You can install this from https://addons.mozilla.org/ko/firefox/addon/naver-endic/
*
*/
let { Ci, Cc } = require("chrome");
let Panel = require("panel").Panel;
@khris
khris / gist:4664150
Last active December 11, 2015 21:39
Cookie synchronization between WebView and HttpClient
CookieManager cookieManager = CookieManager.getInstance();
BasicCookieStore cookieStore = new BasicCookieStore();
final String appDomain = mContext.getResources().getString(R.string.app_domain);
String cookies = cookieManager.getCookie(appDomain);
String[] splitCookies = cookies.split(";");
for (String cookie : splitCookies) {
String[] cookieParts = cookie.split("=");
if (cookieParts.length > 0) {
String cookieValue = "";
if (cookieParts.length >= 2) {
@khris
khris / gist:4706798
Created February 4, 2013 13:41
Rust 0.5 build error on Archlinux x86-64
compile_and_link: x86_64-unknown-linux-gnu/stage0/lib/rustc/x86_64-unknown-linux-gnu/lib/librustc.so
/bin/sh: line 1: 12528 죽었음 x86_64-unknown-linux-gnu/stage0/bin/rustc --cfg stage0 -O --target=x86_64-unknown-linux-gnu -o x86_64-unknown-linux-gnu/stage0/lib/rustc/x86_64-unknown-linux-gnu/lib/librustc.so /home/khris/builds/rust/src/rust-0.5/src/librustc/rustc.rc
make: *** [x86_64-unknown-linux-gnu/stage0/lib/rustc/x86_64-unknown-linux-gnu/lib/librustc.so] 오류 137
==> ERROR: A failure occurred in build().
Aborting...