Skip to content

Instantly share code, notes, and snippets.

View srhyne's full-sized avatar
🏠
Working from home

Stephen Rhyne srhyne

🏠
Working from home
View GitHub Profile
@thiagoghisi
thiagoghisi / bluetooth-restart.sh
Created July 7, 2019 23:56
Script for Mac OSX to Restart Bluetooth service & Reconnect all recently paired devices
#!/bin/bash
echo "Restarting bluetooth service..."
blueutil -p 0 && sleep 1 && blueutil -p 1
echo "Waiting bluetooth service to be restored..."
until blueutil -p | grep "1" >/dev/null; do sleep 1; done
echo "Searching for devices not connected..."
devices=($(blueutil --paired | grep "not connected" | awk -F '[ ,]' '{print $2}'))
@treshugart
treshugart / README.md
Last active May 6, 2024 05:03
HMR for generic web components

Generic web component HMR

I'm messing around with a generic way to do hot-module-replacement with generic web components whether they be vanilla, or done in a framework like Polymer or Skate.

The idea is that you call hmr(customElementConstructor) in your module files and it will set up the proper hooks.

The const filename should be inserted at build time so that it can remember the original localName of the component for the module.

WTF is "x-layout", "Layout" and "filename"

@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@arcenet
arcenet / gist:24015f4e34a00bbaa8f3bcc64c1745e6
Created August 13, 2017 08:55
Installing haveged on Debian/Ubuntu
apt-get install haveged
nano /etc/default/haveged # Setup DAEMON_ARGS="-w 1024"
update-rc.d haveged defaults
cat /dev/random | rngtest -c 1000 # Testing Availability of Entropy & Quality of Random Data
cat /proc/sys/kernel/random/entropy_avail # To test the amount of available entropy
@alexeygrigorev
alexeygrigorev / vimeo-download.py
Created September 17, 2016 09:09
Downloading segmented video from vimeo
import requests
import base64
from tqdm import tqdm
master_json_url = 'https://178skyfiregce-a.akamaihd.net/exp=1474107106~acl=%2F142089577%2F%2A~hmac=0d9becc441fc5385462d53bf59cf019c0184690862f49b414e9a2f1c5bafbe0d/142089577/video/426274424,426274425,426274423,426274422/master.json?base64_init=1'
base_url = master_json_url[:master_json_url.rfind('/', 0, -26) + 1]
resp = requests.get(master_json_url)
content = resp.json()
@stramel
stramel / css-var-polyfill.js
Created September 6, 2016 21:48
CSS Variable Polyfill
/*
TODO:
X Maybe account for defaults: color: var(--header-color, blue);
- Verify cross domain working or not (it is working from dropbox)
- Option to wait to apply anything until all <link>s are parsed or inject what we have and update as each <link> returns
- Need to test on a more complex CSS file
- Option to save parsed file in local/session storage so there isn't a delay on additional page loads. Could only do it for links (with URLs to use as keys) and style blocks with IDs of some sort
- Need to test more complex values like rgba(255,0,0,0.5); and something with !important
- Try multiple links
- Local links
@alekhinen
alekhinen / guiSendMessage.applescript
Created July 21, 2015 18:54
Programmatically send iMessage via GUI through Terminal
on run {targetBuddyPhone, targetMessage}
tell application "System Events"
tell application "Messages" to activate
tell process "Messages"
click menu item "New Message" of menu "file" of menu bar 1
set input to targetMessage as text
delay 1
keystroke targetBuddyPhone
keystroke return
keystroke tab
@v0lkan
v0lkan / nginx.conf
Last active April 2, 2024 18:25
Configuring NGINX for Maximum Throughput Under High Concurrency
user web;
# One worker process per CPU core.
worker_processes 8;
# Also set
# /etc/security/limits.conf
# web soft nofile 65535
# web hard nofile 65535
# /etc/default/nginx
@comerford
comerford / mongo_wt_none.conf
Last active August 29, 2015 14:09
YAML Config for MongoDB 2.7.9 - WiredTiger, compression disabled
storage:
dbPath: "/ssd/db/wt_none"
engine: "wiredTiger"
wiredTiger:
collectionConfig: "block_compressor="
systemLog:
destination: file
path: "/data/wt_none/mongodb.log"
processManagement:
fork: true
@jamiekurtz
jamiekurtz / mongo-enc-provision.sh
Created October 17, 2014 21:55
Shell script for installing and configuring MongoDB on Ubuntu to use a secondary LUKS (dm-crypt) encrypted disk for its database files.
#!/bin/bash
# !!! This script assumes that the device needing to be formatted and encrypted is /dev/sdb
# !!! Also... be sure to copy and store the generated encryption key file from /root
# Note that the secondary drive will be mounted at /var/lib/mongodb,
# ... which is the default location for MongoDB data files on Ubuntu and Mongo at least v2.6
# add PPA for mongodb