Skip to content

Instantly share code, notes, and snippets.

View Deadlyelder's full-sized avatar

Sankalp Deadlyelder

View GitHub Profile
#! /bin/bash
set -euo pipefail
# This script will remove automatic association for all networks not listed in the whitelist
# passed as the first argument. Passwords will NOT be removed from the Keychain.
#
# Alternatively, you can untick "Remember networks" in Network Preferences > Wi-Fi > Advanced,
# but then you won't be able to auto-join networks even temporarily, and you might already
# have a long list to go through.
#
$ bitcoin-cli -testnet getblockhash 7777
0000000007b52c4ff25443ab5a07cea530bb6981aad956116239e9c060bda368
$ bitcoin-cli -testnet getblock 0000000007b52c4ff25443ab5a07cea530bb6981aad956116239e9c060bda368
{
"hash": "0000000007b52c4ff25443ab5a07cea530bb6981aad956116239e9c060bda368",
"confirmations": 1118426,
"strippedsize": 191,
"size": 191,
"weight": 764,
@Deadlyelder
Deadlyelder / Python output.sh
Last active June 12, 2017 09:40
Bitcoin-cli RPC Python call
{u'merkleroot': u'064d68e9b8eb27b6db3a1f993cf8c1fefd4acc86721e30a062abac17de3b2638',
u'nonce': 2057802261, u'previousblockhash': u'00000000010876fecdc6f59b34a95ba790e5140ef694986e4b7ac9aadde3415b',
u'hash': u'0000000007b52c4ff25443ab5a07cea530bb6981aad956116239e9c060bda368', u'version': 1, u'weight': 764,
u'chainwork': u'0000000000000000000000000000000000000000000000000000995099509950', u'mediantime': 1338180889,
u'height': 7777, u'difficulty': 16, u'nextblockhash': u'000000000a14868100bb1cb9cbf25fa853df56c56392556ba66aecc6de0af641',
u'confirmations': 1118429, u'time': 1338180890, u'versionHex': u'00000001', u'strippedsize': 191,
u'tx': [u'064d68e9b8eb27b6db3a1f993cf8c1fefd4acc86721e30a062abac17de3b2638'], u'bits': u'1c0ffff0', u'size': 191}
@Deadlyelder
Deadlyelder / bitcoin_rpc_class.py
Last active May 16, 2024 12:19
A python script that has as a class Class script
from __future__ import print_function
import time, requests, json
class RPCHost(object):
def __init__(self, url):
self._session = requests.Session()
self._url = url
self._headers = {'content-type': 'application/json'}
def call(self, rpcMethod, *params):
payload = json.dumps({"method": rpcMethod, "params": list(params), "jsonrpc": "2.0"})
@Deadlyelder
Deadlyelder / bitcoin_rpc_class_call.py
Last active December 27, 2017 21:22
Calling bitcoin_rpc_class.py
# Default port for the bitcoin testnet is 18332
# The port number depends on the one writtein the bitcoin.conf file
rpcPort = 18555
# The RPC username and RPC password MUST match the one in your bitcoin.conf file
rpcUser = 'Alice'
rpcPassword = 'test'
#Accessing the RPC local server
serverURL = 'http://' + rpcUser + ':' + rpcPassword + '@localhost:' + str(rpcPort)
@Deadlyelder
Deadlyelder / feistel.py
Created June 18, 2017 13:34 — forked from whatisaphone/feistel.py
Unlimited length feistel cipher
import hashlib
class FeistelSHA1:
rounds = 4 # 4 rounds is sufficient as long as the round function is cryptographically secure
split = 1 / 2
def __init__(self, key, rounds=rounds):
self.subkeys = [hashlib.sha1(bytes((i,)) + key).digest() for i in range(rounds)]
@Deadlyelder
Deadlyelder / docker_clean.sh
Last active August 8, 2023 06:08
[Docker] Remove all images and containers
#!/bin/bash
#Stop all containers
docker stop $(docker ps -a -q)
# Force kill the presistant one
docker kill $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@Deadlyelder
Deadlyelder / sendRawEth.c
Created July 23, 2017 07:02 — forked from austinmarton/sendRawEth.c
Send a raw Ethernet frame in Linux
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <stdio.h>
@Deadlyelder
Deadlyelder / SSH_Check.sh
Created August 23, 2017 11:19
Quick check to list the SSH keys on a Linux machines
for keyfile in ~/.ssh/id_*; do ssh-keygen -l -f "${keyfile}"; done | uniq
@Deadlyelder
Deadlyelder / vm.sh
Created September 22, 2017 15:24
VM setting
VBoxManage setextradata mac "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3"
VBoxManage setextradata mac "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata mac "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"
VBoxManage setextradata mac "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata mac "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1