Skip to content

Instantly share code, notes, and snippets.

View urjitbhatia's full-sized avatar

Urjit Singh Bhatia urjitbhatia

View GitHub Profile
Copyright 2019-2022 Opendoor Technologies Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
@uttampawar
uttampawar / gist:5407f998bc3f02f58c4b83b0b4dc20fe
Last active March 28, 2020 05:43
llvm-propeller optimization on the included test program.
Hardware information:
OS: 4.15.0-58-generic (uname -r)
VERSION="18.04.3 LTS (Bionic Beaver)"
GCC: gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
GNU ld (GNU Binutils for Ubuntu) 2.30
$ clang++ -O2 main.cc callee.cc -fpropeller-label -o a.out.labels -fuse-ld=lld
$ perf record -e cycles:u -j any,u -- ./a.out.labels 1000000000 2 >& /dev/null
$LLVM_DIR/llvm-propeller/create_llvm_prof --format=propeller --binary=./a.out.labels --profile=perf.data --out=perf.propeller
@lovasoa
lovasoa / piper.rs
Last active September 12, 2019 07:49
rust : convert a writer function to an io::Read
extern crate pipe;
/**
Some libraries (such as handlebars or serde) offer functions that can generate data when given
an object that implements io::Write.
Some other libraries (such as Rocket) can consume data only from objects implementing io::Read.
Here is an example `piper` function that can be used to make these two kinds of libraries together.
@koenbollen
koenbollen / idle_darwin.go
Created October 3, 2017 14:44
Golang example of detecting user activity (using CGEventSourceSecondsSinceLastEventType from CoreGraphics)
package main
// #cgo LDFLAGS: -framework CoreGraphics
// #include <CoreGraphics/CoreGraphics.h>
import "C"
import (
"fmt"
"math"
)
@vasansr
vasansr / aws_create_users_ubuntu.sh
Last active November 25, 2023 04:11
AWS User Data Script to create users when launching an Ubuntu server EC2 instance
#!/bin/bash
#
# Initial script to create users when launching an Ubuntu server EC2 instance
#
declare -A USERKEY
#
# Create one entry for every user who needs access. Be sure to change the key to their
@abayer
abayer / Jenkinsfile
Created February 15, 2017 15:17
An example Declarative Pipeline Jenkinsfile for Feb 15 2017 demo
// A Declarative Pipeline is defined within a 'pipeline' block.
pipeline {
// agent defines where the pipeline will run.
agent {
// This also could have been 'agent any' - that has the same meaning.
label ""
// Other possible built-in agent types are 'agent none', for not running the
// top-level on any agent (which results in you needing to specify agents on
// each stage and do explicit checkouts of scm in those stages), 'docker',
@zz
zz / UbuntuCongestionControlBBR.md
Last active February 12, 2022 16:46 — forked from chalos/UbuntuCongestionControlBBR.md
Ubuntu using BBR
@kainam00
kainam00 / slowserver.py
Created November 4, 2016 18:36
A simple HTTP server designed to be slow. Useful for testing LB timeouts and such.
#!/usr/bin/env python
# Includes
import getopt
import sys
import os.path
import subprocess
import BaseHTTPServer
import SocketServer
import time
@htp
htp / curl-websocket.sh
Last active April 25, 2024 14:57
Test a WebSocket using curl.
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/
@wenzhixin
wenzhixin / ubuntu14.04-command-line-install-android-sdk
Last active January 16, 2024 21:15
Ubuntu 14.04 command line install android sdk
# install openjdk
sudo apt-get install openjdk-7-jdk
# download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
cd android-sdk-linux/tools
# install all sdk packages