Skip to content

Instantly share code, notes, and snippets.

View ZacSweers's full-sized avatar

Zac Sweers ZacSweers

View GitHub Profile
@tecoholic
tecoholic / xfb.py
Created May 23, 2011 03:53
This sample code (written in Python) demonstrates integrating Facebook Chat using the X-FACEBOOK-PLATFORM authentication mechanism.
#!/usr/bin/env python
# This is a demonstration script for Facebook Chat
# using the X-FACEBOOK-PLATFORM SASL mechanism.
# It requires pyfacebook and pyxmpp to be installed.
# This client only works for desktop applications (configured in the
# developer app), and uses the old-style auth.getSession mechanism to get a
# Facebook session. For newer-style or web apps, only the
# `get_facebook_client` function should have to change.
@chrisroos
chrisroos / gpg-import-and-export-instructions.md
Created September 9, 2011 10:49
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@dedy-purwanto
dedy-purwanto / 10fastfinger_bot.js
Created December 22, 2011 12:44
BOT for 10fastfingers, automatic typing with adjustable speed
/*
* BOT for 10fastfingers, automatic typing with adjustable speed
* ================================================================
*
* bored in my apartment and decided to hack this game: http://indonesian-speedtest.10fastfingers.com/
* just start the game, when you're ready to type, DON'T TYPE ANYTHING, open up
* your Developer Tools in Chrome (CTRL+SHIFT+J) and click Console tab, and
* then paste the whole code below, then press enter, and enjoy the show.
*
* twitter.com/kecebongsoft
@agnoster
agnoster / README.md
Last active April 6, 2024 22:35
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@Antarix
Antarix / UrlImageParser.java
Created November 29, 2012 08:48
UrlImage Parser for android TextView to load Html Image tag
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import android.content.Context;
import android.graphics.Canvas;
@zach-klippenstein
zach-klippenstein / ChangePassword.java
Last active April 3, 2024 18:04
The keystore password on Java keystore files is utterly pointless. You can reset it without knowing it, as shown by this code. Note that private keys are still secure, as far as I know. The JKS implementation is copyright Casey Marshall (rsdio@metastatic.org), and the original source is available at http://metastatic.org/source/JKS.java. I've in…
import java.util.*;
import java.io.*;
import java.security.*;
public class ChangePassword
{
private final static JKS j = new JKS();
public static void main(String[] args) throws Exception
{
@agscala
agscala / vine2gif.py
Created January 30, 2013 21:28
python vine2gif.py [vine_url] [output_file] Scrapes vine url, downloads video, and converts the file to a gif with mplayer
from pyquery import PyQuery as pq
import sys
import subprocess
import os
from urllib2 import urlopen, URLError, HTTPError
def convert(input_file, output_gif):
print "CONVERT", input_file, " => ", output_gif
subprocess.call(["mplayer", input_file, "-ao", "null", "-ss", "0:0:0", "-endpos", "6", "-vo", "gif89a:fps=8:output=%s" % output_gif, "-vf", "scale=240:180"])
@imminent
imminent / ObjectGraph.java
Last active October 23, 2017 07:39
Dagger `ObjectGraph` utility to hide the mess of injecting the different Android classes. Note this is inspired by https://github.com/pyricau/CleanAndroidCode/blob/master/cleanandroidcode/src/main/java/info/piwai/cleanandroidcode/base/GraphRetriever.java
import javax.annotation.Nonnull;
import android.app.Activity;
import android.app.Service;
import android.support.v4.app.Fragment;
import android.content.Context;
/**
* <p>Retrieves the {@link dagger.ObjectGraph} and injects dependencies.</p>
* @author Dandré Allison
@dodyg
dodyg / gist:5823184
Last active March 29, 2024 03:59
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.