Skip to content

Instantly share code, notes, and snippets.

seb's sydneyitguy

  • Seoul, Korea
Block or report user

Report or block sydneyitguy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sydneyitguy
sydneyitguy / instagram.js
Created Jan 22, 2020
Get Instagram Followers
View instagram.js
const random_wait_time = (waitTime = 300) => new Promise((resolve, reject) => {
setTimeout(() => {
return resolve();
}, Math.random() * waitTime);
});
const get_followers = async(userId, userFollowerCount) => {
let userFollowers = [],
batchCount = 20,
actuallyFetched = 20,
@sydneyitguy
sydneyitguy / eth.rb
Created Jan 8, 2020
Ethereum address validation and normalization in Ruby
View eth.rb
# Extracted from https://github.com/se3000/ruby-eth
#
# Dependencies:
# - gem 'digest-sha3'
# - gem 'rlp'
#
# Usage:
# - Eth::Utils.valid_address?('0x4Db7569F90bd836294B11c8b08B853d2de499Ced')
# => true
# - Eth::Utils.format_address('0x4db7569f90bd836294b11c8b08b853d2de499ced')
@sydneyitguy
sydneyitguy / postgres_upgrade.sh
Last active Aug 19, 2019
PostgreSQL upgrade from 10 to 11
View postgres_upgrade.sh
sudo apt install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
psql --version
sudo apt update
sudo apt install postgresql-11
pg_lsclusters
sudo pg_dropcluster 11 main --stop
@sydneyitguy
sydneyitguy / countries+languages.md
Last active Jun 11, 2019
Country & Language Codes
View countries+languages.md

Countries

  • AW: Aruba
  • AF: Afghanistan
  • AO: Angola
  • AI: Anguilla
  • AX: Åland Islands
  • AL: Albania
  • AD: Andorra
  • AE: United Arab Emirates
  • AR: Argentina
@sydneyitguy
sydneyitguy / detectExtension.js
Last active Nov 23, 2018
Detect whether a chrome extension is installed or not
View detectExtension.js
export const isChrome = function() {
return /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
}
export const detectExtension = function(extensionId, callback) {
const xobj = new XMLHttpRequest();
xobj.overrideMimeType("application/json");
xobj.open('GET', 'chrome-extension://' + extensionId + '/manifest.json', true);
xobj.onreadystatechange = function () {
if (xobj.readyState === 4) {
@sydneyitguy
sydneyitguy / pg_index.md
Last active Nov 17, 2018
Postgresql Index Maintenance
View pg_index.md

Index size/usage statistics

Table & index sizes along which indexes are being scanned and how many tuples are fetched. See Disk Usage for another view that includes both table and index sizes.

Works with PostgreSQL >=8.1

SELECT
    t.tablename,
    indexname,
    c.reltuples AS num_rows,
@sydneyitguy
sydneyitguy / eth-key.rb
Last active Aug 10, 2018
Generate a Ethereum key pair / Get public key from a given private key (if a parameter passed)
View eth-key.rb
#!/usr/bin/env ruby
# gem install digest-sha3
require 'openssl'
require 'digest/sha3'
require 'open-uri'
require 'json'
def decode(s, base)
syms = '0123456789abcdef'.freeze
@sydneyitguy
sydneyitguy / fuckjs.js
Created May 11, 2017
Fuck annoying JS preventers (Re-enable copy & paste / right-click functions on the webpage)
View fuckjs.js
javascript:function r(d){d.oncontextmenu=null;d.onselectstart=null;d.ondragstart=null;d.onkeydown=null;d.onmousedown=null; d.body.oncontextmenu=null;d.body.onselectstart=null;d.body.ondragstart=null;d.body.onkeydown=null; d.body.onmousedown=null;};function unify(w){r(w.document);if(w.frames.length>0){for(var i=0;i<w.frames.length;i++){try{unify(w.frames[i].window);}catch(e){}};};}; unify(self);jQuery(document).unbind();jQuery('div, a, p, body, html, section').unbind();
@sydneyitguy
sydneyitguy / LocationActivity.java
Created Jul 10, 2016
Abstract class to extend for Google Play Fused Location Service
View LocationActivity.java
import android.Manifest;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
import android.provider.Settings;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AlertDialog;
View bash_library
#!/bin/bash
#
# StackScript Bash Library
#
# Copyright (c) 2010 Linode LLC / Christopher S. Aker <caker@linode.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
You can’t perform that action at this time.