Skip to content

Instantly share code, notes, and snippets.

View tomsiwik's full-sized avatar
🔴
Recording

Tom Siwik tomsiwik

🔴
Recording
View GitHub Profile
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 3, 2024 19:09
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@tylerneylon
tylerneylon / .block
Last active May 3, 2024 01:21
Quick js code to draw math functions in an SVG element.
license: mit
@gbaman
gbaman / HowToOTG.md
Last active May 2, 2024 01:27
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

@highfestiva
highfestiva / binance-liquidation-calculator.py
Last active April 16, 2024 06:13
CLI Binance liquidation calculation formula
#!/usr/bin/env python3
'''2021-03-26: Reverse-engineer by searching for the following terms in features*.js:
- bracketMaintenanceMarginRate
- cumFastMaintenanceAmount
- bracketNotionalFloor
- bracketNotionalCap'''
# (max) position, maintenance margin, maintenance amount
maint_lookup_table = [
@thomasfr
thomasfr / iptables.sh
Last active April 13, 2024 01:59
iptable rules to allow outgoing DNS lookups, outgoing icmp (ping) requests, outgoing connections to configured package servers, outgoing connections to all ips on port 22, all incoming connections to port 22, 80 and 443 and everything on localhost
#!/bin/bash
IPT="/sbin/iptables"
# Server IP
SERVER_IP="$(ip addr show eth0 | grep 'inet ' | cut -f2 | awk '{ print $2}')"
# Your DNS servers you use: cat /etc/resolv.conf
DNS_SERVER="8.8.4.4 8.8.8.8"
# Allow connections to this package servers
@mkuklis
mkuklis / lambda-image-resizer.js
Created July 31, 2018 17:53
AWS Lambda for image resizing with sharp
const sharp = require('sharp');
const aws = require('aws-sdk');
const s3 = new aws.S3();
const Bucket = "BucketName";
const transforms = [
{ name: 'small', size: 85 },
{ name: 'medium', size: 160 },
{ name: 'large', size: 250 },
];
@learncodeacademy
learncodeacademy / flightplan-deploy.md
Last active January 7, 2024 11:58
Deploy Node.js Apps with Flightplan

##Setup your server (this would ideally be done with automated provisioning)

  • add a deploy user with password-less ssh see this gist
  • install forever npm install -g forever

##Install flightplan

  • npm install -g flightplan
  • in your project folder npm install flightplan --save-dev
  • create a flightplan.js file
@chalasr
chalasr / simple-git-branching-model.md
Last active October 15, 2023 11:44 — forked from jbenet/simple-git-branching-model.md
a simple git branching model

a simple git branching model

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@zhiguangwang
zhiguangwang / README.md
Last active August 25, 2023 12:47
Disable and Enable kdc on Mac OS X

If you don't like or need the kdc process on Mac OS X, which opens TCP port 88 to the world, you can disable it with launchctl.

Disable:

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.Kerberos.kdc.plist

Enable:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.Kerberos.kdc.plist