Skip to content

Instantly share code, notes, and snippets.

View zulhfreelancer's full-sized avatar

Zulhilmi Zainudin zulhfreelancer

View GitHub Profile
@zulhfreelancer
zulhfreelancer / 1_phantomErrors.js
Created October 21, 2019 15:41 — forked from artjomb/1_phantomErrors.js
Error event handlers for PhantomJS and CasperJS: PhantomJS and CasperJS don't show errors on the page by default. This can give clues as to what did go wrong.
var page = require('webpage').create(),
url = 'http://example.com/';
// Put the event handlers somewhere in the code before the action of
// interest (opening the page in question or clicking something)
// http://phantomjs.org/api/webpage/handler/on-console-message.html
page.onConsoleMessage = function(msg, lineNum, sourceId) {
console.log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")');
};
@zulhfreelancer
zulhfreelancer / cross-compile-go.bash
Created December 24, 2018 16:41 — forked from dlsniper/cross-compile-go.bash
Cross compile Go for Raspberry Pi 3
cd ~
git clone [email protected]:golang/go.git gotip
cd gotip/src
export GOROOT_BOOTSTRAP=/usr/local/go
env GOOS=linux GOARCH=arm GOARM=7 ./make.bash
@zulhfreelancer
zulhfreelancer / zsh.md
Last active March 21, 2020 05:28 — forked from tsabat/zsh.md
How to install zsh in Ubuntu 16 on EC2

Prereq:

If you want to change the hostname, follow this guide.

sudo apt update -y && sudo apt install -y zsh git-core

Getting zsh to work in ubuntu is weird, since sh does not understand the source command. So, you do this to install zsh

@zulhfreelancer
zulhfreelancer / .change-tab-color-pwd
Created October 30, 2018 17:03 — forked from jakeonrails/.change-tab-color-pwd
How to have change the tab color in iTerm2 based on what folder or directory you are in
#!/usr/bin/env python
"""
Set terminal tab / decoration color by the server name.
Get a random colour which matches the server name and use it for the tab colour:
the benefit is that each server gets a distinct color which you do not need
to configure beforehand.
"""
@zulhfreelancer
zulhfreelancer / push_more.rb
Created April 14, 2018 11:37 — forked from marckohlbrugge/push_more.rb
Example code for sending notification with Telegram's @PushMoreBot
require "net/https"
class PushMore
WEBHOOK_URL = "https://pushmore.io/webhook/REPLACE_WITH_YOUR_TOKEN"
def initialize(body)
@body = body
end
def deliver
@zulhfreelancer
zulhfreelancer / Readme.md
Created April 2, 2018 09:43 — forked from mxstbr/Readme.md
Enable tab completion for JSX with Emmet in Atom

Enable tab completion for JSX with Emmet in Atom

This guide assumes you have the emmet and language-babel packages already installed in Atom

Gif of the tab completion working

  1. Open the keymap.cson file by clicking on Atom -> Keymap… in the menu bar
  2. Add these lines of code to your keymap:
'atom-text-editor[data-grammar~="jsx"]:not([mini])':
@zulhfreelancer
zulhfreelancer / HelloYou.sol
Created March 17, 2018 13:25 — forked from lukehedger/HelloYou.sol
Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.18+commit.9cf6e910.js&optimize=undefined&gist=
pragma solidity ^0.4.18;
// import './SomeContract.sol';
contract HelloYou {
event Hello(address you);
function sayHello() public {
address _person = msg.sender;

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@zulhfreelancer
zulhfreelancer / medium_LightsailAndDocker_Blob.sh
Created December 14, 2017 06:56 — forked from JoshuaTheMiller/medium_LightsailAndDocker_Blob.sh
A series of commands formatted in such a way that it just needs to be copy pasted into a terminal. Installs the latest community edition of Docker.
sudo apt-get update; \
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common -y; \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -; \
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
@zulhfreelancer
zulhfreelancer / 1_kubernetes_on_macOS.md
Created November 30, 2017 14:05 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites