Skip to content

Instantly share code, notes, and snippets.

View ptisserand's full-sized avatar
💭
Learning Rust

ptisserand

💭
Learning Rust
View GitHub Profile
@ptisserand
ptisserand / gist:25cd1153715e8731a23c95d548748215
Created October 2, 2017 10:47
shell script to use wakeonlan image docker
#!/bin/bash -e
NAS_MAC="00-11-32-44-A5-AF"
WAKE_IMG="ptisserand/wakeonlan"
docker run --rm --net=host -t ${WAKE_IMG} ${NAS_MAC}
@ptisserand
ptisserand / gist:29dd8d4643c67fad47599d77a1198b25
Created July 18, 2019 09:39
Q&D workaround patch for cordova-plugin-background-geolocation ITMS-90338
diff --git a/ios/CDVBackgroundGeolocation/CocoaLumberjack.h b/ios/CDVBackgroundGeolocation/CocoaLumberjack.h
index 32a4deb..c384e25 100644
--- a/ios/CDVBackgroundGeolocation/CocoaLumberjack.h
+++ b/ios/CDVBackgroundGeolocation/CocoaLumberjack.h
@@ -739,7 +739,6 @@ NSString * DDExtractFileNameWithoutExtension(const char *filePath, BOOL copy);
* This protocol describes a dynamic logging component
*/
@protocol DDRegisteredDynamicLogging
-
/**
@ptisserand
ptisserand / docker-compose.yml
Created February 14, 2020 18:17
docker-compose to run mitmproxy with web interface using docker volume
version: '3.4'
services:
app:
image: mitmproxy/mitmproxy
ports:
- 8080:8080
- 8081:8081
volumes:
- mitmproxy:/home/mitmproxy/.mitmproxy
@ptisserand
ptisserand / start-docker-cache.bash
Created March 26, 2020 16:33
Start a proxy to speed up docker build
#!/bin/bash
CACHE_DIR=/srv/squid/cache
echo "Starting squid container"
docker run --rm --net host -v ${CACHE_DIR}:/var/cache/squid3 -d jpetazzo/squid-in-a-can
echo "Setup iptables"
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to 3129 -w
@ptisserand
ptisserand / Vagrantfile
Created April 8, 2020 11:46
Using HTTP proxy for vagrant
Vagrant.configure("2") do |config|
if Vagrant.has_plugin?("vagrant-proxyconf")
config.proxy.http = "http://192.168.0.110:3128/"
# config.proxy.https = "http://192.168.0.2:3128/"
# config.proxy.no_proxy = "localhost,127.0.0.1,.example.com"
end
# ... rest of the configurations
end
@ptisserand
ptisserand / add_timestamp.sh
Created April 10, 2020 08:22
Add timestamp with ffmpeg
ffmpeg -i INPUT.mp4 -vf "drawtext=fontfile=/usr/share/fonts/TTF/Roboto-Medium.ttf:fontsize=22:fontcolor=yellow:box=1:boxcolor=black:x=(W-tw)/2:y=H-th-10:text='%{pts\:hms} %{frame_num}'" OUTPUT.mp4
@ptisserand
ptisserand / getit.py
Last active May 5, 2021 08:57
Python code to retrieve gateway IP
def get_default_gateway():
try:
hip = None
with open("/proc/self/net/route") as routes:
for line in routes:
parts = line.split('\t')
if '00000000' == parts[1]:
hip = parts[2]
if hip is not None and len(hip) == 8:
@ptisserand
ptisserand / extract_private.py
Created May 2, 2022 18:16
Extract private key from Terra Station Wallet export
#!/usr/bin/env python
#
# Extract private key from Terra Station Wallet exported private key
#
# python ./extract_private.py "DATA FROM 'Export Wallet' - 'Private Key'" "your password"
#
# Your private key base64 encoded will be print on stdout
#
import sys
@ptisserand
ptisserand / main.mo
Last active June 10, 2022 20:45
blog post
import HashMap "mo:base/HashMap";
import Iter "mo:base/Iter";
import Nat "mo:base/Nat";
import Hash "mo:base/Hash";
import Principal "mo:base/Principal";
import Result "mo:base/Result";
import Text "mo:base/Text";
import Time "mo:base/Time";
import TrieMap "mo:base/TrieMap";
import TrieSet "mo:base/TrieSet";
@ptisserand
ptisserand / str_to_felt
Last active July 21, 2022 06:54
starknet edu utils
#!/bin/bash
#
# Copy in the same directory as utils.py
# Set executable rights:
# $ chmod uog+x ./str_to_felt
# Run:
# $ ./str_to_felt HENRI
# 310400406089
#