Skip to content

Instantly share code, notes, and snippets.

View anonoz's full-sized avatar
🎣
ikan duit

anonoz

🎣
ikan duit
View GitHub Profile
@anonoz
anonoz / mysqli_db_conn.php
Last active August 29, 2015 14:24
PDO vs MySQLi
<?php
// Our database config
$db_host = "localhost";
$db_user = "yolol";
$db_pass = "yolol_pass";
$db_name = "yolol";
// Connect to our MySQL database
$conn = mysqli_connect($db_host, $db_user, $db_pass, $db_name);
@anonoz
anonoz / chanwaikok.rb
Created August 27, 2015 13:12
TSN2201 Question 3 Solution
require 'sinatra'
require 'sinatra/reloader' if development?
helpers do
def protected!
return if authorized?
headers['WWW-Authenticate'] = 'Basic realm="Restricted Area"'
halt 401, "Not authorized\n"
end
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Travelling Salesman Problem Cyberjaya
#
# Usage:
# python tspcyber.py [<destination> ...]
#
# If no destination is passed in, it's assumed that rider
# will travel to all destinations.
#
# destination can be:
# dpulze, mmu, cyberia, mutiaraville, mdec, ntt,

The Incomplete Study Guide for RoR Interviews Outside Malaysia

This gist serves as a reminder for myself or for anyone who has found this on what to prepare. At this point, I have failed approximately 5 interviews (and counting) in Singapore, China, and Hong Kong. On the bright side, doing interviews allowed me to find out the gaps I have in my programming knowledge.

Take note:

  1. Just because there are questions I notice being asked by companies in certain territories, does not mean all companies in that territory will ask those, nor does it mean no companies outside the territories stated won't ask them.
  2. The number of companies I have interviewed with is considerably small. This study guide covers very little ground of what can actually be asked.
  3. Every failed interview gets you closer to better offers. So don't give up, keep going, you are bound to make it.

Database

_Observation: It seems like Chinese and Hong Kong companies tend to ask questions related to the underlying data structures used b

@anonoz
anonoz / Dockerfile
Last active July 23, 2017 18:25
Dockerfile for you to test Webpacker-enabled Rails including yarn, phantomjs on circleci v2
FROM ruby:2.4.1
# nodejs
RUN curl -sL https://deb.nodesource.com/setup_7.x | bash -
# yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -\
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
# finally the rest
@anonoz
anonoz / Dockerfile
Created March 26, 2018 03:13
Sample of multistage Dockerfile for Rails app in production
FROM madnight/docker-alpine-wkhtmltopdf as wkhtmltopdf_savior
# STAGE for bundle & yarn install
FROM ruby:2.4.3-alpine3.7 as builder
ENV CA_CERTS_PATH /etc/ssl/certs/
ENV RAILS_ENV production
ENV RAILS_LOG_TO_STDOUT true
ENV RAILS_SERVE_STATIC_FILES true

trying to mess with scoot wifi

02:02AM SGT - I am currently on TR 734 SIN-TXL.

$ dig anonoz.com

; <<>> DiG 9.11.4-RedHat-9.11.4-1.fc28 <<>> anonoz.com
;; global options: +cmd
;; Got answer:
@anonoz
anonoz / txt-01.md
Last active December 15, 2018 05:41
Get China work permit as Malaysian
@anonoz
anonoz / hellogold.rb
Last active August 23, 2019 10:59
Check HelloGold AUM and HGT's yield
#!/usr/bin/env ruby
require 'json'
require 'open-uri'
require 'bigdecimal'
hg_json = JSON.parse(open('https://www.hellogold.com/data.json').read)
aum_grams = hg_json['data'].map { |a| a['gold_balance'] }.sum
gecko_json = JSON.parse(open('https://api.coingecko.com/api/v3/coins/hellogold?tickers=true&market_data=true&community_data=false&developer_data=false&sparkline=false').read)
# hgt_market_cap = BigDecimal(gecko_json['market_data']['market_cap']['usd'], 15)