Skip to content

Instantly share code, notes, and snippets.

@creativepsyco
creativepsyco / install.sh
Last active August 29, 2015 13:56
Installation file for transifex
sudo apt-get install python python-setuptools python-imaging python-dev gettext intltool python-django python-pip git unzip zip
easy_install -U setuptools
easy_install http://trac.transifex.org/files/deps/contact_form-0.3.tar.gz
easy_install http://trac.transifex.org/files/deps/userprofile-0.7-r422-correct-validation.tar.gz
pip install celery chardet "Django==1.3.1" "django-addons>=0.6.6" "django-ajax-selects==1.1.4" "django-authority" "django-celery" django-kombu django-picklefield "django-piston==0.2.2" "django-social-auth" "django-sorting>=0.1" "django-tagging-autocomplete==0.3.1" "django-threadedcomments>=0.9" "django-userena" "hiredis>=0.1.0" httplib2 markdown "PIL>=1.1.7" "polib==0.6.3" pygooglechart pysolr "redis>=2.4.10" requests "South==0.7.3" "BeautifulSoup==3.2.0" "django-staticfiles==1.2.1" python-magic
pip install 'https://pypi.python.org/packages/source/d/django-filter/django-filter-0.5.1.tar.gz#md5=f28c24251ba108940ddc5b77a4ed829d'
@creativepsyco
creativepsyco / gist:9322214
Last active August 29, 2015 13:56
Host Python Server in Current Directory.
#Python 2
python -m SimpleHTTPServer 8080
#Python 3
python3 -m http.server 8113
@creativepsyco
creativepsyco / setup.sh
Created March 11, 2014 16:49
setup bundle
mkdir mozilla
hg init mozilla
cd mozilla
wget http://ftp.mozilla.org/pub/mozilla.org/firefox/bundles/mozilla-central.hg
hg unbundle mozilla-central.hg
configurations {
apt
}
dependencies {
compile 'com.squareup.dagger:dagger:1.1.0'
apt 'com.squareup.dagger:dagger-compiler:1.1.0'
}
android.applicationVariants.all { variant ->
//
// !!WARNING: Not recommended for production code!!
//
public class ClassLoaderActivity extends Activity
{
public void onCreate(Bundle savedInstanceState)
{
// file.jar has a dex'd "classes.dex" entry that you can generate with "dx" from any number of JARs or class files
ClassLoader dexLoader = new DexClassLoader("/path/to/file.jar", getCacheDir().getAbsolutePath(), null, getClassLoader());
setAPKClassLoader(dexLoader);
public class Dexter {
private static String optimizedDirectory = "optimized";
private static String workDirectory = "working";
public static void loadFromAssets(Context context, String fileName) throws Exception {
File optimized = new File(optimizedDirectory);
optimized = context.getDir(optimized.toString(), Context.MODE_PRIVATE);
optimized = new File(optimized, fileName);
/home/msk/Desktop/tb/comm-central/obj-x86_64-unknown-linux-gnu/mozilla/_virtualenv/bin/python -u /home/msk/Desktop/tb/comm-central/mozilla/config/pythonpath.py \
-I./build \
-I/home/msk/Desktop/tb/comm-central/mozilla/build \
-I./_tests/mozbase/mozinfo \
/home/msk/Desktop/tb/comm-central/mozilla/testing/xpcshell/runxpcshelltests.py \
--manifest=./_tests/xpcshell/xpcshell.ini \
--build-info-json=./mozinfo.json \
--interactive \
--test-plugin-path='dist/plugins' \
--tests-root-dir=/home/msk/Desktop/tb/comm-central/obj-x86_64-unknown-linux-gnu/mozilla/_tests/xpcshell \
@creativepsyco
creativepsyco / CommonEventLoop.java
Last active August 29, 2015 14:03
This script logs data to PaperTrail. Do change your port. CommonLoop is attached which allows for Requests to be scheduled on a single executor thread
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
public class CommonEventLoop {
private static CommonEventLoop __instance;
private ScheduledExecutorService m_executor = Executors.newSingleThreadScheduledExecutor();
@creativepsyco
creativepsyco / StripTokens.java
Created August 27, 2014 03:02
useful gist to clean up tokens from the log string
private static String stripTokens(String log) {
if (HIDE_TOKENS) {
/* Common REGEX patterns for replacing tokens */
log = log.replaceAll("token=\\S*", "token=ACCESS_TOKEN_REMOVED ");
log = log.replaceAll("client_secret=\\S*", "client_secret=CLIENT_SECRET_REMOVED ");
log = log.replaceAll("access_token=\\S*", "access_token=ACCESS_TOKEN_REMOVED ");
log = log.replaceAll("code=\\S*", "code=SOME_CODE_REMOVED ");
}
return log;
}
@creativepsyco
creativepsyco / stupidity.sh
Created October 28, 2014 05:40
Bash file stupid
#!/bin/bash
# Run this in the terminal and keep waiting for the response.
for i in `seq 1 1000000`;
do
echo $i
curl 'http://giphy.com/ajax/contest/vote' -H 'Cookie: __qca=P0-1475105941-1414474206710; _cb_ls=1; __asc=949617dd149553b8dfc7f2b22f2; __auc=949617dd149553b8dfc7f2b22f2; __utma=157163181.13407325.1414474207.1414474207.1414474207.1; __utmb=157163181.2.10.1414474207; __utmc=157163181; __utmz=157163181.1414474207.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); _chartbeat2=851IKu1DUaBZ3vbj.1414474208673.1414474469947.1' -H 'X-NewRelic-ID: VwQBUlZWGwEAVlJSAwI=' -H 'Origin: http://giphy.com' -H 'Accept-Encoding: gzip,deflate' -H 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: */*' -H 'Referer: http://giphy.com/stickershop/sticker/a2FpeWVlLnRheUBnbWFpbC5jb20' -H 'X-CSRFToken: undefined' -H 'X-Requested-