Skip to content

Instantly share code, notes, and snippets.

@ethicnology
ethicnology / blackHijack.sol
Last active March 17, 2019 22:55
Hijackable smartContract : Let your classmates find the trick
/*
* __________________________________________________________________________________________________________________
* | | |
* | ________ ___ ________ ________ ___ __ ___ ___ ___ ___ ________ ________ ___ __ |
* | |\ __ \|\ \ |\ __ \|\ ____\|\ \|\ \ |\ \|\ \|\ \ |\ \|\ __ \|\ ____\|\ \|\ \ |
* | \ \ \|\ /\ \ \ \ \ \|\ \ \ \___|\ \ \/ /|\ \ \\\ \ \ \ \ \ \ \ \|\ \ \ \___|\ \ \/ /|_ |
* | \ \ __ \ \ \ \ \ __ \ \ \ \ \ ___ \ \ __ \ \ \ __ \ \ \ \ __ \ \ \ \ \ ___ \ |
* | \ \ \|\ \ \ \____\ \ \ \ \ \ \____\ \ \\ \ \ \ \ \ \ \ \|\ \\_\ \ \ \ \ \ \ \____\ \ \\ \ \ |
* | \ \_______\ \_______\ \__\ \__\ \_______\ \__\\ \__\ \__\ \__\ \__\ \________\ \__\ \__\ \_______\ \__\\ \__\ |
* | \|_______|\|_______|\|__|\|__|\|_______|\|__| \|__|\|__|\|__|\|__|
@ethicnology
ethicnology / bloatware-remover-redmi-note-9-s.sh
Created August 30, 2020 14:07
bloatware remover for xiaomi redmi note 9 s
# inspired by https://selivan.github.io/2020/02/25/removing-bloatware-from-xiaomi-miui-android.html
pm uninstall --user 0 com.xiaomi.mipicks #GetApps - app store like Google Play from Xiaomi. The most annoying one, periodically shows advertisement.
pm uninstall --user 0 com.miui.msa.global #MIUI Ad Services - also responsible for showing ads.
pm uninstall --user 0 com.miui.cloudservice #Cloud
pm uninstall --user 0 com.miui.cloudbackup #Cloud Backup
pm uninstall --user 0 com.xiaomi.glgm #Games
pm uninstall --user 0 com.xiaomi.payment #Mi Credit
pm uninstall --user 0 cn.wps.xiaomi.abroad.lite #Mi DocViewer(Powered by WPS Office)
pm uninstall --user 0 com.xiaomi.midrop #Mi ShareMe
pm uninstall --user 0 com.miui.yellowpage #Mi YellowPages
@ethicnology
ethicnology / bitcoin-full-node.sh
Last active July 9, 2022 07:23
wget, chmod +x and execute
#!/bin/bash
echo Setup bitcoin full node.
echo Specify bitcoin version, e.g. 22.0:
read version
echo Install bitcoin-core version $version
#Download bitcoin-core:
wget https://bitcoincore.org/bin/bitcoin-core-$version/bitcoin-$version-x86_64-linux-gnu.tar.gz
#Download the list of cryptographic checksums:
wget https://bitcoincore.org/bin/bitcoin-core-$version/SHA256SUMS
#Download the signatures attesting to validity of the checksums:

gnuplot

plot multiple files

plot for [i=0:5] 'degree_distribution_step:'.i.'_delta:5' title 'Degree step '.i ps 2

ps=point size

plot file to gif/png/svg script

@ethicnology
ethicnology / elements.sh
Last active March 19, 2022 13:52
build elements blockchain
#!/bin/bash
sudo apt install git
cd
git clone https://github.com/ElementsProject/elements.git
sudo apt-get update
sudo apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev
sudo apt-get install libboost-all-dev
sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler imagemagick librsvg2-bin
sudo apt-get install libqrencode-dev autoconf openssl libssl-dev libevent-dev
@ethicnology
ethicnology / mdadm.txt
Last active April 20, 2022 06:49
mdadm
```
mdadm --detail /dev/mdX
```
```
mdadm --stop /dev/mdX
```
```
mdadm --assemble --force /dev/mdX /dev/sda /dev/sdb /dev/sdc /dev/sdd
@ethicnology
ethicnology / ufw.md
Last active June 26, 2023 07:53
ufw

ufw

sudo bash << EOF
ufw --force reset
ufw default deny incoming
ufw default deny outgoing
ufw limit 22                  # ssh
ufw allow out 53              # dns
ufw allow out 80 # http
@ethicnology
ethicnology / vtt2srt
Last active December 22, 2022 16:15
Converts .vtt to .srt subtitles with python3
#!/usr/bin/env python
# put this file in /usr/local/bin
# vtt2srt my_subtitle.vtt
import os, re, argparse
parser = argparse.ArgumentParser()
parser.add_argument("filename", help=".vtt file")
args = parser.parse_args()
input_path_filename = args.filename
@ethicnology
ethicnology / yt-dlp_batch_prefix.md
Last active December 29, 2022 08:51
yt-dlp download from batch-file with S01E01 like prefix based on the index of the URL in the file

yt-dlp download from batch-file with S01E01 like prefix based on the index of the URL in the file

Here is a brief description of what the Bash command I provided does:

  • It sets the variable $season to the season number.
  • It sets the variable $index to the current video index.
  • It uses a while loop to read each line of the file batch-url.txt and extract the URL from each line using awk.
  • If the line is not empty and does not start with a # character (i.e. if it is not a comment), it passes the URL to the yt-dlp command with the filename prefix "S" followed by the season number (contained in the $season variable), followed by "E" and the index of the current line, with a leading zero added if the index is less than 10 (e.g. "01" instead of "1").

This command allows you to download multiple videos from an input batch file by adding the season number and index of each video to the filename prefix.
Note: this command will only work if the yt-dlp command is installed on your system. If it is n

@ethicnology
ethicnology / meraki_freeshop.js
Created February 15, 2023 11:55
Meraki freeshop google sheet script
function check_limit() {
// Get the active sheet
var sheet = SpreadsheetApp.getActiveSheet();
// Get the range of the selected column
var data = sheet.getDataRange().getValues();
// Count the rows
var numRows = data.length;
var startRow = 4;
var limitCol = 3;
// Save the selected the Column