Skip to content

Instantly share code, notes, and snippets.

View andersondanilo's full-sized avatar

Anderson Danilo andersondanilo

View GitHub Profile
@andersondanilo
andersondanilo / configure_iptables_transocks_and_create_ap.sh
Last active December 27, 2023 15:54
Redirect trafic to transocks, can also redirect from the "create_ap" network (wifi hotspot)
#!/usr/bin/bash
# Transocks: https://github.com/cybozu-go/transocks
# 1. Install: go get -u github.com/cybozu-go/transocks/...
# Note: depending on your vension of go, you will need the env: GO111MODULE=on
# 2. Create a "transocks" user
# 3. Execute: sudo -u transocks $HOME/go/bin/transocks -f transocks.toml
set -e
stty -echoctl
@andersondanilo
andersondanilo / instructions.md
Last active October 27, 2024 23:48
ms2109 linux (MacroSilicon USB Video)

Play

ffplay -f video4linux2 -framerate 60 -video_size 1920x1080 -input_format mjpeg /dev/video2

You can try other video number (video3, video4)

Maybe you need:

Create: /etc/udev/rules.d/91-hdmi-to-usb-ms2109.rules With:

@andersondanilo
andersondanilo / range_intersection.py
Created April 29, 2021 15:13
range intersection
def inter(range1, range2):
return range2[1] >= range1[0] and range2[0] <= range1[1]
testcases = [
(True, [1, 10], [5, 6]),
(True, [5, 5], [5, 5]),
(True, [1, 5], [5, 10]),
(False, [1, 5], [6, 10]),
]
#!/usr/bin/bash
set -e
DEFAULT_KEY_ID=614C8C06DE5CB261AFC3EEE257F3E6589075F87C
SECRETS_KEY_ID=D1B5E88C16D8BD692D241317CAD86B57997C00AD
DEFAULT_PUB_FILE=anderson-default.pub.gpg
DEFAULT_SECRET_FILE=anderson-default-secret.asc.gpg
SECRETS_PUB_FILE=anderson-secrets.pub.gpg
SECRETS_SECRET_FILE=anderson-secrets-secret.asc.gpg

Keybase proof

I hereby claim:

  • I am andersondanilo on github.
  • I am andersondanilo (https://keybase.io/andersondanilo) on keybase.
  • I have a public key whose fingerprint is 614C 8C06 DE5C B261 AFC3 EEE2 57F3 E658 9075 F87C

To claim this, I am signing this object:

@andersondanilo
andersondanilo / instructions.txt
Created September 11, 2021 20:39
Snap connect local themes
The folder would looks like that:
.
├── local-source
│   └── share
│   ├── icons
│   │   └── oomox-CustomOneHalf
│   └── themes
│   └── oomox-CustomOneHalf
@andersondanilo
andersondanilo / test.md
Last active January 24, 2022 18:42
testing slow connection to one service

Example with redis (using https://github.com/bcoe/crapify)

./crapify start --port 7070 --speed 1000

Let this port forwarding the redis through the proxy:

socat TCP-LISTEN:6381,reuseaddr,fork PROXY:localhost:redis:6379,proxyport=7070