Skip to content

Instantly share code, notes, and snippets.

View VinnyOG's full-sized avatar

Paweł Czarnecki VinnyOG

View GitHub Profile
#!/bin/ksh
# To restore a backup (rough notes, basically the inverse of making the backup):
# cd /tmp
# scp -i /var/juniperd/rsync $SERVER/2024-04-08* .
# HMAC_KEY=$(openssl enc -base64 -in /var/juniperd/hmac.key)
# openssl dgst -binary -sha256 -hmac $HMAC_KEY 2024-04-08*.db.gz.enc > expected_hmac
# openssl enc -base64 -in expected_hmac
# openssl enc -base64 -in 2024*.hmac
# -- MAKE SURE THEY MATCH --
@VinnyOG
VinnyOG / passthrough_func.ts
Created December 9, 2021 00:54
ts passthrough func
<F extends (...args: any[]) => Promise<any>>(func: F) => (...args: Parameters<F>) => ReturnType<F>
@VinnyOG
VinnyOG / isCloudFrontIp.js
Created January 29, 2020 23:26
Does ip belong to a cloud front CIDR block?
// http://d7uri8nf7uskq.cloudfront.net/tools/list-cloudfront-ips
// Last pulled January 22, 2020
const CLOUDFRONT_IPS = {
'CLOUDFRONT_GLOBAL_IP_LIST': [
'144.220.0.0/16',
'52.124.128.0/17',
'54.230.0.0/16',
'54.239.128.0/18',
'52.82.128.0/19',
@VinnyOG
VinnyOG / zip_iterator.cpp
Created July 10, 2019 18:04
zip iterator (needs work)
template <typename Container1, typename Container2>
class zip_iterator {
using it_type1 = decltype(std::declval<Container1>().begin()); //typename Container1::iterator;
using it_type2 = decltype(std::declval<Container2>().begin()); //typename Container2::iterator;
it_type1 c1_it;
it_type2 c2_it;
@VinnyOG
VinnyOG / swap_monitors.cpp
Created April 30, 2019 23:51
Swap side monitors in 3 monitor set-up
/*
Usage: you have 3 monitors hooked up to your mac (2 external 1 internal)
mac goes bonkers sometimes after returning from sleep. swaps the monitors >_</
this program counters that :)
g++ --std=c++17 -framework ApplicationServices -o swap_monitors swap_monitors.cpp
Create a service in Automator to run the program, then assign a shortcut (I use CTRL+CMD+M)
Enjoy!
@VinnyOG
VinnyOG / dockercomposecoreos.txt
Created April 28, 2018 01:58
docker-compose for coreos
mkdir -p /opt/bin
curl -L https://github.com/docker/compose/releases/download/1.21.1/docker-compose-`uname -s`-`uname -m` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose
@VinnyOG
VinnyOG / shared office 365 activation
Created April 24, 2018 19:31
Enable office 365 on computer using remote desktop services
If you've already deployed Office 365 ProPlus,
you can enable shared computer activation on a computer by using Registry Editor to add
a string value of SharedComputerLIcensing with a setting of 1 under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\Configuration.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod
169 for a single user connection? at least lifetime server licenses are free for students 🚆
env XDG_CURRENT_DESKTOP=GNOME gnome-control-center
client
dev tun
proto tcp
remote us2.ovpn-tcp.pointtoserver.com 80
persist-key
persist-tun
ca ca.crt
tls-auth Wdc.key 1
cipher AES-256-CBC
comp-lzo