Skip to content

Instantly share code, notes, and snippets.

Avatar

Seokmin, Lee drakestone

View GitHub Profile
View cipher.js
const crypto = require('crypto');
// Encrypting...
// WARNING: createCipher() is deprecated
const cipher = crypto.createCipher('aes-256-cbc', '0000');
let alphabetUpperCase = `ABCDEFGHIJKLMNOPQRSTUVWXYZ`;
let cipherText = cipher.update(alphabetUpperCase, 'utf8', 'base64');
console.log(`cipher.update('${alphabetUpperCase}') returns `, `'${cipherText}'`);
View gist:64fa32344ab9c139a423
import java.util.List;
import java.util.ArrayList;
public class SortingString {
public static void main(String args[]) {
String s = "typewriter";
final long start = System.currentTimeMillis();
for (int i = 0; i < Integer.MAX_VALUE; i++) {
View MainActivity.java
package com.example.gee;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;
public class MainActivity extends Activity {
@Override
View Config.java
package com.example.gee;
public class Config {
public final static String Company = "@COMPANY@";
}
View Config.java
package com.example.gee;
public class Config {
public final static String Company = "Google";
}
@drakestone
drakestone / custom_rules.xml
Last active Dec 23, 2015
Ant 빌드시 company name 입력 받아서 빌드 코드에 반영하는 custom 빌드 스크립트
View custom_rules.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="Gee" default="help">
<target name="deploy" depends="clean">
<property file="build.properties" />
<property name="config-target-path" value="${source.dir}/com/example/gee"/>
<input message="Please input company name" addproperty="company" />
<!-- Copy the configuration file, replacing tokens in the file. -->
<copy file="config/Config.java" todir="${config-target-path}"
@drakestone
drakestone / gist:5002897
Created Feb 21, 2013
Package 명으로 Application 실행하기
View gist:5002897
Intent intent = getPackageManager().getLaunchIntentForPackage("com.android.settings");
if (intent != null)
startActivity(intent);
else
Toast.makeText(MainActivity.this,
"Could not launch this package.",
Toast.LENGTH_LONG).show();
@drakestone
drakestone / gist:5002890
Created Feb 21, 2013
ActivityManager 로 부터 package 명 가져오기
View gist:5002890
final ActivityManager am = (ActivityManager)getSystemService(ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> infos = am.getRunningTasks(100);
for (ActivityManager.RunningTaskInfo info : infos) {
Log.d(TAG, info.baseActivity.getPackageName());
}
@drakestone
drakestone / gist:5002888
Last active Dec 14, 2015
PackageManager 에서 application package 명 얻어내기.
View gist:5002888
final PackageManager pm = getPackageManager();
List<ApplicationInfo> applications = pm.getInstalledApplications(PackageManager.GET_META_DATA);
for (ApplicationInfo appInfo : applications) {
PackageInfo pkgInfo;
try {
pkgInfo = pm.getPackageInfo(appInfo.packageName,
PackageManager.GET_META_DATA |
PackageManager.GET_PERMISSIONS);
@drakestone
drakestone / gist:4974780
Created Feb 18, 2013
Patched SlidingMenu.java Full source
View gist:4974780
package com.slidingmenu.lib;
import java.lang.reflect.Method;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
You can’t perform that action at this time.