Skip to content

Instantly share code, notes, and snippets.

@crazy2be
crazy2be / gist:6202377
Created August 10, 2013 22:03
Get a list of files that are affecting your github language statistics, so that you can identify incorrectly counted autogenerated files. A little bit hacky. Probably. I'm not sure, since I don't know ruby that well.
# This file is borrowed from
# https://github.com/github/linguist/blob/master/lib/linguist/repository.rb
# Most of my modifications near the bottom.
# Appologies if the code is difficult to understand, I don't really
# know ruby very well...
require 'linguist/file_blob'
module Linguist
# A Repository is an abstraction of a Grit::Repo or a basic file
# system tree. It holds a list of paths pointing to Blobish objects.
@vikrum
vikrum / AndroidManifest.xml
Last active April 6, 2024 12:00
Firebase+Android sample app with background Service + local notifications.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.bgfirebaseapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="17" />
@aiwilliams
aiwilliams / 00-api_github_com_readme.md
Last active December 19, 2015 19:49
Exploring CORS on api.github.com.

Be sure to test the 08 html document using the http:// protocol.

01-05 were requests made to api.github.com using curl. I wanted to see what the response headers looked like, where:

  • 01 - Simple GET with no credentials.
  • 02 - Simple GET with Basic (username:password).
  • 03 - Simple GET with Basic, my own user - the response certainly included private information about me, the authenticated user.
  • 04 - Creating an OAUTH token - do these, too, have Access-Control-* headers? Yes!
  • 05 - Simple GET with Authorization token.

06-09 demonstrate a CORS request from an HTML document on my hard drive (08), loaded by Chrome (28.0.1500.71), where:

@olly
olly / csv_progress_bar.rb
Last active October 3, 2019 19:44
Progress Bars for Ruby's CSV
require 'csv'
# https://rubygems.org/gems/progress_bar
require 'progress_bar'
class CSV
module ProgressBar
def progress_bar
::ProgressBar.new(@io.size, :bar, :percentage, :elapsed, :eta)
end
@trongthanh
trongthanh / gist:1196596
Created September 6, 2011 04:37
Emulate slow Internet connection speed on localhost with netem (Ubuntu)
#Refer: http://www.linuxfoundation.org/collaborate/workgroups/networking/netem#Delaying_only_some_traffic
#Refer: http://www.bomisofmab.com/blog/?p=100
#Refer: http://drija.com/linux/41983/simulating-a-low-bandwidth-high-latency-network-connection-on-linux/
#Setup the rate control and delay
sudo tc qdisc add dev lo root handle 1: htb default 12
sudo tc class add dev lo parent 1:1 classid 1:12 htb rate 56kbps ceil 128kbps
sudo tc qdisc add dev lo parent 1:12 netem delay 200ms
#Remove the rate control/delay
sudo tc qdisc del dev lo root
@kylelemons
kylelemons / scripttemplate.sh
Created July 19, 2011 22:52
BASH Script template
###
### Usage: blah [<options>]
###
### Description of the script
###
### Options:
### -f --flag
### Description of the flag
### -o --option <arg>
### Description of the option and argument
:+1:
:-1:
:airplane:
:art:
:bear:
:beer:
:bike:
:bomb:
:book:
:bulb: