Skip to content

Instantly share code, notes, and snippets.

View shurane's full-sized avatar

Ehtesh Choudhury shurane

  • Astoria, NY | Seattle, WA
  • 02:23 (UTC -07:00)
View GitHub Profile
@izacus
izacus / MainActivity.java
Created May 1, 2015 21:24
Test example
package com.example.test;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.graphics.PointF;
import android.net.Uri;
import android.os.ConditionVariable;
@c4milo
c4milo / yourservice.conf
Created April 25, 2011 18:05
upstart example script
# Ubuntu upstart file at /etc/init/yourservice.conf
pre-start script
mkdir -p /var/log/yourcompany/
end script
respawn
respawn limit 15 5
start on runlevel [2345]
@andre1810
andre1810 / list_vagrant_port_forwardings.rb
Last active April 2, 2021 17:52
List Port Forwardings of vagrant machines
vm_infos = `vboxmanage list vms`
puts 'Port Forwardings:'
puts '---------------------------------'
vm_infos.each_line do |vm_info|
vm_name = vm_info.scan(/\"(.*)\"/)
vm_id = vm_info.scan(/.*{(.*)}/).join('')
vm_detail_info = `vboxmanage showvminfo #{vm_id}`
@spulec
spulec / pre-commit
Last active January 13, 2023 02:26
Yipit Pre-commit Hook
#!/usr/bin/env python
import os
import re
import subprocess
import sys
modified = re.compile('^[MA]\s+(?P<name>.*)$')
CHECKS = [
@leviwilson
leviwilson / HttpUrlActivityTest.java
Created September 4, 2012 16:24
Mock HttpURLConnection Example
package com.example.robolectric;
import static com.xtremelabs.robolectric.Robolectric.shadowOf;
import static org.mockito.Mockito.verify;
import java.io.IOException;
import java.net.*;
import org.junit.Before;
import org.junit.Test;
@buhman
buhman / 00 wpa_cli passphrase network
Last active March 8, 2023 21:51
all wpa_cli ommands can be tab-completed
localhost ~ # cat <<EOF> /etc/wpa_supplicant.conf
ctrl_interface=DIR=/run/wpa_supplicant GROUP=wheel
update_config=1
EOF
localhost ~ # wpa_supplicant -iwlp1s0 -Dnl80211 -c/etc/wpa_supplicant.conf -B
Successfully initialized wpa_supplicant
localhost ~ # wpa_cli
wpa_cli v2.0
Copyright (c) 2004-2012, Jouni Malinen <j@w1.fi> and contributors
@beng
beng / autolog.py
Last active April 3, 2023 16:28 — forked from brendano/autolog.py
modified from the original to remove the use of global variables, implement a logging class instead of relying on sys.stdout, remove the function log decorator, remove the module log decorator, allow color changing on any log call, allow indentation level changing on any log call, and PEP-8 formatting.
# Written by Brendan O'Connor, brenocon@gmail.com, www.anyall.org
# * Originally written Aug. 2005
# * Posted to gist.github.com/16173 on Oct. 2008
# Copyright (c) 2003-2006 Open Source Applications Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@uogbuji
uogbuji / pixelbook-dev-setup.md
Last active July 10, 2023 14:53 — forked from cassiozen/pixelbook-dev-setup.md
Notes on setting up Pixelbook for development

Pixelbook or Pixel Slate Setup

Partly updated June 2023

General caution: Chrome OS is a secure OS by design, but this has at least one key consequence. If you change your Google account password, you will still be required to enter the old password the next time you access each Chrome OS device. Devices are encrypted with that password, so the OS needs to decrypt using the old password then re-encrypt using the new one. If you forget your old password you will lose access to your Chrome OS device data. As always, make sure you keep backups up to date.

Fast User Switching

If you have multiple Chrome OS accounts (Say, work and play), you can quickly sitch between them without logging out:

@gburd
gburd / clang-blocks.c
Created November 19, 2012 20:26
ANSI-C lambda blocks
/*
sudo apt-get install libblocksruntime-dev
clang -fblocks clang-blocks.c -lBlocksRuntime -o clang-blocks
CAVEAT: only works with clang and BlocksRuntime
*/
#include <stdio.h>
int main(void)
{
@joemccann
joemccann / nginx + node setup.md
Created October 25, 2010 02:06
Set up nginx as a reverse proxy to node.js.

The idea is to have nginx installed and node installed. I will extend this gist to include how to install those as well, but at the moment, the following assumes you have nginx 0.7.62 and node 0.2.3 installed on a Linux distro (I used Ubuntu).

In a nutshell,

  1. nginx is used to serve static files (css, js, images, etc.)
  2. node serves all the "dynamic" stuff.

So for example, www.foo.com request comes and your css, js, and images get served thru nginx while everything else (the request for say index.html or "/") gets served through node.

  1. nginx listens on port 80.