Skip to content

Instantly share code, notes, and snippets.

@meowsbits
meowsbits / geth-jsonrpc-transports-shell.sh
Last active December 7, 2020 17:22
How to hit geth's JSON RPC over different transports.
#!/usr/bin/env bash
# HTTP
curl -X POST $(curl icanhazip.com/v4):8545 --data '{"jsonrpc":"2.0","method":"trace_transaction","params":["0x552280896083bfe801a1f70c84011d1b4195a2c08d2221f80245380775cd6270"],"id":1}' -H "Content-Type: application/json
http --json POST http://localhost:8545 id:=$(date +%s) method='rpc_discover' params:='[]'
# Websocket
echo rpc.discover | websocat -B 650000 -n1 --jsonrpc ws://localhost:8546
# IPC
@catchdave
catchdave / replace_synology_ssl_certs.sh
Last active April 28, 2024 07:17
CLI script to programmatically replace SSL certs on Synology NAS
#!/bin/bash
#
# *** For DSM v7.x ***
#
# How to use this script:
# 1. Get your 3 PEM files ready to copy over from your local machine/update server (privkey.pem, fullchain.pem, cert.pem)
# and put into a directory (this will be $CERT_DIRECTORY).
# Personally, I use this script (https://gist.github.com/catchdave/3f6f412bbf0f0cec32469fb0c9747295) to automate steps 1 & 4.
# 2. Ensure you have a user setup on synology that has ssh access (and ssh access is setup).
# This user will need to be able to sudo as root (i.e. add this line to sudoers, <USER> is the user you create):
@rfikki
rfikki / ropsten-peers-latest.txt
Last active September 24, 2022 03:23
Updated July 15, 2020: Ropsten Latest Peers with Istanbul - IMPORTANT RUN THE LATEST RELEASE OF THE CLIENT - https://geth.ethereum.org/downloads/
admin.addPeer("enode://8c5131f577ee602ccaad5e5f600011c024d43d33e6af6f8a89ed26cbfadd7efe903a8e426dde4071b857e0838a2efa29ae3b268f8b55acd59e72d4a919673cbc@13.251.47.174:30303");
admin.addPeer("enode://798b8eba7b65cdd71bb061a6b18a1f7d16612d54e1aa542d8dc5c3573322b5dd7496c1eea100dbb84f8495d89f3d5ddb4142b0006a73cd32daa2f643bd5d1c76@175.24.29.183:30311");
admin.addPeer("enode://9a4be35fec78cf91e7e959029ae3f5d3d3e86446186eb14f181c8f3b9917f57839ef98d4ba53cf06eb4fea696ecc14796b34d96db4f4294864edfcab27dd9956@31.220.51.107:30303");
admin.addPeer("enode://2763ab6d19d6e7ce7a953ba95c9a87fe6ae5eac3434bf216282f53142d89cb5451faa701311d7de1d79cc8ecbd57f1781156e26f5722aee835547aeab870e385@52.237.88.221:30303");
admin.addPeer("enode://81488a6c0b62aa14a1172d607893b6317e4f2565ca2bd73c7c0b8bfd55842af6b7972218728d1f352b3fddc61d0dccbf92e81d2bbfdc375db44ae44ee332d4db@88.198.59.75:30303");
admin.addPeer("enode://3d55f613d74e90f5b8a4154d20d8a7260a973751c1402bf52adde2b08b72a9e0327a522bf187765f2d6e2a3b893dfe7aa41b204bce5f793bd9470f24fa3aafc
@zachleat
zachleat / rwdurl
Last active February 5, 2019 02:20
A command line utility to open a url with a bunch of different screen widths (and organize the windows).
# My Chrome developer profile is in the `Profile 1` directory, make sure to update with yours.
# Best on an ultra wide monitor.
function rwdurl() {
open -n -g -a "Google Chrome" --args --new-window --profile-directory=Profile\ 1 --app="data:text/html,<html><body><script>window.moveTo(0,0);window.resizeTo(320,1395);window.location='$1';</script></body></html>"
open -n -g -a "Google Chrome" --args --new-window --profile-directory=Profile\ 1 --app="data:text/html,<html><body><script>window.moveTo(330,0);window.resizeTo(480,1395);window.location='$1';</script></body></html>"
open -n -g -a "Google Chrome" --args --new-window --profile-directory=Profile\ 1 --app="data:text/html,<html><body><script>window.moveTo(815,0);window.resizeTo(640,1395);window.location='$1';</script></body></html>"
open -n -g -a "Google Chrome" --args --new-window --profile-directory=Profile\ 1 --app="data:text/html,<html><body><script>window.moveTo(1460,0);window.resizeTo(800,1395);window.location='$1';</script></body></html>"
open -n
@felquis
felquis / url-schemes.md
Last active April 15, 2024 06:38
iOS, Android browser apps URL Schemes to handle URL between browsers, and apps..

Assume the user is on a mobile device iOS Safari (Or other browser), but you want a link to open into any other specific mobile browser app like Chrome, Safari, Firefox, Opera, Arc... How do you do that?

Chrome

To open on Chrome

<a href="googlechrome://example.com">try it on Chrome</a>

check out Chrome iOS Docs for more information

@fbeeper
fbeeper / easyiosapps
Created September 15, 2014 17:30
Finally! Here's the easy access to your iOS8 simulator apps you've been looking for :)
#!/bin/bash
#
# Using the information available in the new iOS8 simulator for each
# device/runtime (device.plist), this script creates a readable folder structure
# (no UDIDs, just simple device/runtime names). Inside that structure it creates
# soft links to your apps in development.
#
# You can run this script every time you install an app to your simulator, or
# you can simply call it to access this folder making sure it will always be
# updated :)
@turowicz
turowicz / swift-json-class.md
Last active February 21, 2017 07:00
Apple Swift strong type object serialization to JSON
@higepon
higepon / API.swift
Last active July 31, 2023 16:00
An example of JSON API call in Swift
//
// API.swift
//
// Created by Taro Minowa on 6/10/14.
// Copyright (c) 2014 Higepon Taro Minowa. All rights reserved.
//
import Foundation
typealias JSONDictionary = Dictionary<String, AnyObject>

This Gist contains the script and generated output file for an Acer B276HUL.

The pre-generated file below is known to work with:

  • OS X Mavericks
  • OS X Yosemite
  • OS X El Capitan

For El Capitan:

  1. Restart your Mac while holding Command-R: this puts your Mac into Recovery Mode.
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten