Skip to content

Instantly share code, notes, and snippets.

View carlware's full-sized avatar
🎯
Focusing

Carlos Ramirez carlware

🎯
Focusing
View GitHub Profile
@carlware
carlware / how to use
Last active July 23, 2024 13:42
proxychains and tor (change ip ~10 seconds)
# install
sudo apt-get install proxychains
sudo apt-get install tor
# then update the files /etc/proxychains.conf and /etc/tor/torrc with the given config
# restart tor server
sudo service restart tor
@carlware
carlware / gist-chain.go
Last active April 25, 2019 00:44
unary and stream interceptors in go
s := grpc.NewServer(
grpc.StreamInterceptor(
grpc_middleware.ChainStreamServer(
GetStreamServerInterceptor(),
grpc_prometheus.StreamServerInterceptor)),
grpc.UnaryInterceptor(
grpc_middleware.ChainUnaryServer(
GetUnaryServerInterceptor(),
grpc_prometheus.UnaryServerInterceptor)))
@carlware
carlware / client.rb
Created February 12, 2017 00:39 — forked from amscotti/client.rb
RPC using Redis
require 'redis'
require 'securerandom'
require 'msgpack'
class RedisRpcClient
def initialize(redis_url, list_name)
@client = Redis.connect(url: redis_url)
@list_name = list_name.to_s
end
#!/bin/bash
#
# Bash script to setup headless Selenium (uses Xvfb and Chrome)
# (Tested on Ubuntu 12.04) trying on ubuntu server 14.04
# Add Google Chrome's repo to sources.list
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list
# Install Google's public key used for signing packages (e.g. Chrome)
# (Source: http://www.google.com/linuxrepositories/)
@carlware
carlware / README.md
Created January 3, 2017 22:01 — forked from rantav/README.md
Find slow queries in mongo DB

A few show tricks to find slow queries in mongodb

Enable profiling

First, you have to enable profiling

> db.setProfilingLevel(1)

Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target...

@carlware
carlware / jupyter_shortcuts.md
Created January 2, 2017 02:10 — forked from kidpixo/jupyter_shortcuts.md
Keyboard shortcuts for ipython notebook 3.1.0 / jupyter

Toc

Keyboard shortcuts

The IPython Notebook has two different keyboard input modes. Edit mode allows you to type code/text into a cell and is indicated by a green cell border. Command mode binds the keyboard to notebook level actions and is indicated by a grey cell border.

MacOS modifier keys:

  • ⌘ : Command
ls /dev/tty.usb*
# might require root
cu -l /dev/tty.usbmodemXXXX -s 115200
@carlware
carlware / projected_area.py
Created July 29, 2016 05:23 — forked from robinkraft/projected_area.py
get the area in square meters of a polygon using shapely and pyproj
import pyproj
from shapely.geometry import shape
from shapely.ops import transform
geom = {'type': 'Polygon',
'coordinates': [[[-122., 37.], [-125., 37.],
[-125., 38.], [-122., 38.],
[-122., 37.]]]}
s = shape(geom)
@carlware
carlware / Spark+ipython_on_MacOS.md
Created March 8, 2016 06:21 — forked from ololobus/Spark+ipython_on_MacOS.md
Apache Spark installation + ipython notebook integration guide for Mac OS X

Apache Spark installation + ipython notebook integration guide for Mac OS X

Tested with Apache Spark 1.3.1, Python 2.7.9 and Java 1.8.0_45 + workaround for Spark 1.4.x from @enahwe.

Install Java Development Kit

Download and install it from oracle.com

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: