Skip to content

Instantly share code, notes, and snippets.

All the following commands use hyper plus the key listed:

  • enter - Default layout (edit in init.lua)
  • up - Make current window fullscreen
  • down - Place current window in center of screen
  • right - place current window in right half
  • left - place current window in left half
  • a - Quick app switcher
  • j - Quick window switcher (focused app)
  • d - Move current window to other screen
@ctolsen
ctolsen / curl_to_ab.py
Last active June 3, 2024 11:59
"Copy to cURL" in Chrome to Apache Bench command
#!/usr/bin/env python3
import sys
import os
def curl_to_ab(curl_cmd: list, num: int=200, cur: int=4) -> str:
"""
Translate a cURL command created by Chrome's developer tools into a
command for ``ab``, the ApacheBench HTTP benchmarking tool.
from scapy.all import *
def arp_display(pkt):
if pkt[ARP].op == 1: #who-has (request)
if pkt[ARP].psrc == '0.0.0.0': # ARP Probe
if pkt[ARP].hwsrc == '74:75:48:5f:99:30': # Huggies
print "Pushed Huggies"
elif pkt[ARP].hwsrc == '10:ae:60:00:4d:f3': # Elements
print "Pushed Elements"
else:
print "ARP Probe from unknown device: " + pkt[ARP].hwsrc
from scapy.all import *
def arp_display(pkt):
if pkt[ARP].op == 1: #who-has (request)
if pkt[ARP].psrc == '0.0.0.0': # ARP Probe
print "ARP Probe from: " + pkt[ARP].hwsrc
print sniff(prn=arp_display, filter="arp", store=0, count=10)
@kristopolous
kristopolous / hn_seach.js
Last active July 24, 2023 04:12
hn job query search
// Usage:
// Copy and paste all of this into a debug console window of the "Who is Hiring?" comment thread
// then use as follows:
//
// query(term | [term, term, ...], term | [term, term, ...], ...)
//
// When arguments are in an array then that means an "or" and when they are seperate that means "and"
//
// Term is of the format:
// ((-)text/RegExp) ( '-' means negation )
@tomdavidson
tomdavidson / install_gnucmd_osx.sh
Created July 19, 2015 19:11
Installs GNU Command Line Tools & then some.
#!/usr/bin/env bash
# Installs GNU Command Line Tools & then some. Requires homebrew.
# Most are newer and more powerful that than OSX’s but also solves most OS compatibility issues
echo "Installing GNU coreutils and various."
export PATH="$(brew --prefix coreutils)/libexec/gnubin:/usr/local/bin:$PATH"
brew install coreutils
brew install binutils
brew install diffutils
brew install ed --with-default-names
brew install findutils --with-default-names
@benkulbertis
benkulbertis / cloudflare-update-record.sh
Last active April 28, 2024 16:35
Cloudflare API v4 Dynamic DNS Update in Bash
#!/bin/bash
# CHANGE THESE
auth_email="user@example.com"
auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # found in cloudflare account settings
zone_name="example.com"
record_name="www.example.com"
# MAYBE CHANGE THESE
ip=$(curl -s http://ipv4.icanhazip.com)
@MarcMeszaros
MarcMeszaros / apk.py
Last active August 29, 2015 14:20
A python script that wraps the Android adb tool to make it simpler to pull APK files from a device.
#!/usr/bin/env python
import argparse
import sys
from subprocess import call, check_output
# version check
if sys.hexversion < 0x02070000:
sys.exit('Python 2.7 or newer is required to run this program.')
@tarvitz
tarvitz / shell.py
Created July 4, 2014 08:59
Google App Engine remote(local) shell with ipython detection and small battaries inside
#!/usr/bin/env python
# coding: utf-8
#
# Copyright 2007 Google Inc.
#
# 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
#
@mcummins
mcummins / faster_get_multi.py
Last active February 5, 2021 00:06
Fetch a set of keys directly from App Engine memcache, instead of using ndb. Almost 3x faster if everything is in memcache.
# This Gist is an alternative to ndb.get_multi which is a lot faster in some circumstances.
# For example, fetching 500 small entities with 90% hit rate is 3x faster than ndb,
# based on my tests in App Engine production environment (F1).
# In general it is worthwhile when fetching a large number of small entities, with >50% memcache hit rate.
# For any keys not in memcache, it falls back on a normal ndb.get_multi
# The code is based on the original ndb.context code, but avoids the task queue overhead.
import logging
from google.appengine.api import memcache