Skip to content

Instantly share code, notes, and snippets.

Avatar

Zulhilmi Zainudin zulhfreelancer

View GitHub Profile
@zulhfreelancer
zulhfreelancer / 1_phantomErrors.js
Created Oct 21, 2019 — 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.
View 1_phantomErrors.js
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 Dec 24, 2018 — forked from dlsniper/cross-compile-go.bash
Cross compile Go for Raspberry Pi 3
View cross-compile-go.bash
cd ~
git clone git@github.com: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 Mar 21, 2020 — forked from tsabat/zsh.md
How to install zsh in Ubuntu 16 on EC2
View zsh.md

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 Oct 30, 2018 — 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
View .change-tab-color-pwd
#!/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.
"""
View software.md

Hi, this is Arun and you have reached the list of software I maintain actively.

I tend to use the cmdline heavily and most of my software is about making life easier on the terminal. However, some of the utilities have seamless GUI integration or can be used as a backend to a GUI frontend.

It's many years of work but I still enjoy it thoroughly, thanks to awesome users, collaborators and maintainers.

bcal (C)

Mathematical storage expression calculator. It runs in a REPL (read-eval-print loop) and can perform storage unit arithmetic, conversions (IEC & SI) and CHS-LBA calculations.

Buku (Python3)

@zulhfreelancer
zulhfreelancer / push_more.rb
Created Apr 14, 2018 — forked from marckohlbrugge/push_more.rb
Example code for sending notification with Telegram's @PushMoreBot
View push_more.rb
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 Apr 2, 2018 — forked from mxstbr/Readme.md
Enable tab completion for JSX with Emmet in Atom
View Readme.md

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 Mar 17, 2018 — 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=
View HelloYou.sol
pragma solidity ^0.4.18;
// import './SomeContract.sol';
contract HelloYou {
event Hello(address you);
function sayHello() public {
address _person = msg.sender;
View postgres cheatsheet.md

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 Dec 14, 2017 — 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.
View medium_LightsailAndDocker_Blob.sh
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) \