Skip to content

Instantly share code, notes, and snippets.

@abhinavmsra
abhinavmsra / pg_locks.md
Created March 21, 2019 08:44
How to list postgres locks & release them

List all active locks

SELECT 
  DISTINCT age(now(), query_start) AS age, 
  pg_stat_activity.pid,
  pg_locks.granted,
  pg_stat_activity.application_name,
  pg_stat_activity.backend_start, 
 pg_stat_activity.xact_start, 
@abhinavmsra
abhinavmsra / ballot_test.sol
Created May 24, 2019 03:26
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.8+commit.23d335f2.js&optimize=true&gist=
import "remix_tests.sol"; // this import is automatically injected by Remix.
import "./ballot.sol";
contract test3 {
Ballot ballotToTest;
function beforeAll () public {
ballotToTest = new Ballot(2);
}
@abhinavmsra
abhinavmsra / cff.sol
Created May 26, 2019 06:09
CFF 4 UNICEF - SURGE BANGKOK
pragma solidity >=0.4.22 <0.7.0;
contract CFF {
struct CFFChild {
string name;
string homeAddress;
uint dob; // timestamp of birth of a child,
uint withdrawalBalance;
uint lockedBalance;