Skip to content

Instantly share code, notes, and snippets.

@dylan-lom
dylan-lom / wordlist.asc
Created February 22, 2019 12:05
wordlist

a aahed aahing aardvark aardvarks aardwolf abaci aback abacus abacuses

@dylan-lom
dylan-lom / geth_init.sh
Last active June 3, 2019 09:59
Initiate a Geth Instance
#!/bin/bash
#assumes geth is in path
mkdir /tmp/geth
geth account new --datadir /tmp/geth << EOF | grep ^Address | cut -d'{' -f2 | cut -d'}' -f1 > /tmp/geth/accounts.txt
EOF
pragma solidity ^0.5.1;
contract Test {
function t() public pure returns (bool){
return true;
}
}
const Web3 = require('web3');
const web3 = new Web3('http://localhost');
const abi = [{"constant": true,"inputs": [],"name": "t","outputs": [{"name": "","type": "bool"}],"payable": false,"stateMutability": "pure","type": "function"}];
const addr = "0x9f1a96f41d3dcbc0a77a75af071f0cf8c046cac4";
contract = web3.eth.Contract(abi, addr);
contract.methods.t().call({from: web3.eth.getAccounts()[0]}).then(console.log);
//outputs: true
pragma solidity ^0.5.1;
/**
* @title NoteChain
* @dev The NoteChain contract provides functions to store notes in blockchain
*/
contract NoteChain {
// EVENTS
@dylan-lom
dylan-lom / permission.java
Created December 2, 2019 03:33
example android get permission
// declare your constant at the top of class
// list of permissions:
// https://developer.android.com/reference/android/Manifest.permission.html
public void requestPermissions(View view){
// we require the CHANGE_WIFI_STATE permission, request this
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
Log.e("requestPermissions", "Permission not granted!");
mRttRequestHelper = new RttRequestHelper(
mContext,
new RttRangingResultCallback(){
@Override
public void job(List<RangingResult> results) {
// do things
for (RangingResult result: results) {
if (result.getStatus() != RangingResult.STATUS_SUCCESS) {
Log.e(TAG, "Ranging failed with status: " + result.getStatus());
@dylan-lom
dylan-lom / 01-fixps3.rules
Last active July 26, 2023 20:02
Fake PS3 controller fix & udev rule
DRIVER=="usb", SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="028e", RUN+="/usr/local/bin/fixcontroller.py"
@dylan-lom
dylan-lom / gist:a30d9f4d4ce4f20611a049f9ef78a1e2
Created December 14, 2021 11:27
Create a new Sql Server 2019 instance in a docker container with the AdventureWorks2019 sample database
#!/usr/bin/env sh
#
# Create a new Sql Server 2019 instance in a docker container
# with the AdventureWorks2019 sample database
set -xe
name="gitsql"
test -d backup || mkdir backup
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#define FNV_OFFSET_BASIS 0x811c9dc5
#define FNV_PRIME 0x01000193
typedef unsigned int uint;