Skip to content

Instantly share code, notes, and snippets.

View bdx0's full-sized avatar

Dương Bảo Duy bdx0

View GitHub Profile
@xavierd
xavierd / complete.cc
Created December 29, 2010 15:20
Hacking with libclang completion.
#include <clang-c/Index.h>
#include <cstdlib>
#include <iostream>
/*
* Compile with:
* g++ complete.cc -o complete -lclang -L/usr/lib/llvm
* Run with:
* LIBCLANG_TIMING=1 ./complete file.cc line column [clang args...]
*/
@halfninja
halfninja / Android.mk
Created February 15, 2011 20:57
Building FFMPEG+libx264 for Android NDK
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := videokit
FFMPEG_LIBS := $(shell find ffmpeg -name '*.a')
LOCAL_CFLAGS += -Iffmpeg
LOCAL_LDLIBS += -llog $(FFMPEG_LIBS)
LOCAL_SRC_FILES := jni_interface.c
include $(BUILD_SHARED_LIBRARY)
@romannurik
romannurik / DashboardLayout.java
Created March 23, 2011 05:06
A custom Android layout class that arranges children in a grid-like manner, optimizing for even horizontal and vertical whitespace.
/*
* ATTENTION:
*
* This layout is now maintained in the `iosched' code.google.com project:
*
* http://code.google.com/p/iosched/source/browse/android/src/com/google/android/apps/iosched/ui/widget/DashboardLayout.java
*
*/
/*
@alecplumb
alecplumb / ShakeDetector.java
Created October 20, 2011 21:12
Roboguice Android shake detector
import roboguice.activity.event.OnPauseEvent;
import roboguice.activity.event.OnResumeEvent;
import roboguice.event.EventManager;
import roboguice.event.Observes;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import com.google.inject.Inject;
@mipmip
mipmip / gist:1844353
Created February 16, 2012 12:00
Mac OS X: restart mDNSResponder
Load up Terminal (Applications > Utilities > Terminal.app) and type the following.
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
To turn it back on, just do the opposite:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
@nalitzis
nalitzis / gist:2667108
Created May 12, 2012 15:11
Unit test with AsyncTask
public class NetworkTasksTest extends InstrumentationTestCase{
public void testGetMedia() throws Throwable{
final Context context = getInstrumentation().getTargetContext();
final CountDownLatch signal = new CountDownLatch(1);
final NetworkTasks networkTasks = new NetworkTasks(context, new GetMediaListener(signal));
runTestOnUiThread(new Runnable() {
@iamatypeofwalrus
iamatypeofwalrus / roll_ipython_in_aws.md
Last active January 22, 2024 11:18
Create an iPython HTML Notebook on Amazon's AWS Free Tier from scratch.

What

Roll your own iPython Notebook server with Amazon Web Services (EC2) using their Free Tier.

What are we using? What do you need?

  • An active AWS account. First time sign-ups are eligible for the free tier for a year
  • One Micro Tier EC2 Instance
  • With AWS we will use the stock Ubuntu Server AMI and customize it.
  • Anaconda for Python.
  • Coffee/Beer/Time
(defun rejeep-projectile-completion-fn (prompt choises)
"Projectile completion function that only shows file name.
If two files have same name, new completion appears to select between
them. These include the path relative to the project root."
(interactive)
(let* ((stripped-choises
(-uniq (--map (file-name-nondirectory it) choises)))
(choise
(ido-completing-read prompt stripped-choises))
@rxaviers
rxaviers / gist:7360908
Last active July 26, 2024 15:31
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@yetithefoot
yetithefoot / stuns
Last active July 13, 2024 17:34 — forked from zziuni/stuns
STUN+TURN servers list
{url:'stun:stun01.sipphone.com'},
{url:'stun:stun.ekiga.net'},
{url:'stun:stun.fwdnet.net'},
{url:'stun:stun.ideasip.com'},
{url:'stun:stun.iptel.org'},
{url:'stun:stun.rixtelecom.se'},
{url:'stun:stun.schlund.de'},
{url:'stun:stun.l.google.com:19302'},
{url:'stun:stun1.l.google.com:19302'},
{url:'stun:stun2.l.google.com:19302'},