Skip to content

Instantly share code, notes, and snippets.

View khare-ashwini's full-sized avatar

Ashwini Khare khare-ashwini

View GitHub Profile
#include <iostream>
#include <queue>
#include <cmath>
using namespace std;
priority_queue<int> Q, T;
int main() {
int test=0, tests; cin >> tests;
int D;
@michaelsanford
michaelsanford / gcap.sh
Last active August 29, 2015 14:03
Android screenshot (Glass, Wear, mobile)
#!/usr/bin/env bash
##
# Screencaps, pulls, and deletes the png from a device.
#
# gcap [w | a | device identifier]
#
# For debugging over Bluetooth (i.e., Android Wear), see
# https://developer.android.com/training/wearables/apps/bt-debugging.html
#
@cerebrl
cerebrl / 1-securing-express.md
Last active August 2, 2023 22:48
Securing ExpressJS

tl;dr

  1. Don't run as root.
  2. For sessions, set httpOnly (and secure to true if running over SSL) when setting cookies.
  3. Use the Helmet for secure headers: https://github.com/evilpacket/helmet
  4. Enable csrf for preventing Cross-Site Request Forgery: http://expressjs.com/api.html#csrf
  5. Don't use the deprecated bodyParser() and only use multipart explicitly. To avoid multiparts vulnerability to 'temp file' bloat, use the defer property and pipe() the multipart upload stream to the intended destination.
@fanzeyi
fanzeyi / scroll.css
Created November 1, 2012 18:34
Google Plus Scroll Style
::-webkit-scrollbar{
height:16px;
overflow:visible;
width:16px;
}
::-webkit-scrollbar-button{
height:0;
width:0;
}
@psychemedia
psychemedia / Cross Domain JQuery with Yahoo Pipes Proxy
Created February 27, 2010 12:20
Make cross domain JSON calls in JQuery for JSON feeds that don't support JSONP. Using a Yahoo Pipe as a proxy, pass in the URI for your JSON feed from any domain, and grab the Pipe's JSONP proxy output into your page.
function cross_domain_JSON_call(url){
// url points to a JSON feed
// eg http://openlylocal.com/committees.json?council_id=111
url="http://pipes.yahoo.com/ouseful/jsonproxy?url="+encodeURIComponent(url)+"&_render=json&_callback=?";
$.getJSON(
url,
function(data) { myCallbackFunction(data.value.items[0]); }
)