Skip to content

Instantly share code, notes, and snippets.

View rexlow's full-sized avatar
🏸
Need to workout more!

Rex Low rexlow

🏸
Need to workout more!
View GitHub Profile
@rexlow
rexlow / rename.py
Last active November 14, 2018 08:22
Simple Python script to rename all files in a directory
# -*- coding: utf-8 -*-
"""
Created on Tuesday Nov 13
This script is to rename all files in a directory according to a pattern without changing file extension
@author: Rex Low
@github: rexlow
"""
import os
Process: Python [23472]
Path: /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python
Identifier: Python
Version: 3.7.0 (3.7.0)
Code Type: X86-64 (Native)
Parent Process: zsh [22997]
Responsible: Python [23472]
User ID: 501
Date/Time: 2018-10-09 14:39:32.725 +0800
@rexlow
rexlow / captainRooms.py
Created July 16, 2018 07:40
Hackerrank The Captain's Room Challenge
from collections import Counter
a, b = int(input()), list(map(int, input().split()))
d = dict(Counter(b))
print(min(d, key=lambda k: d[k]))
import React, { Component } from 'react';
import { NetInfo, View, Text } from 'react-native';
import { connect } from 'react-redux';
import { Actions } from 'react-native-router-flux';
import { updateNetworkStatus, updateTabbar, initInitialScreen, pullUserData } from '../../actions'
import firebase from 'react-native-firebase';
import type { Notification } from 'react-native-firebase';
import { BottomNavigation } from 'react-native-paper';
@rexlow
rexlow / gist:2b2d4f8c814fa5853faf2a9205a84ddc
Created April 4, 2018 01:41 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@rexlow
rexlow / filter.m
Created March 5, 2018 09:26
Matlab Filter Exercise
clear all
close all
clc
elon_ori = imread('elon.jpg');
elon = elon_ori(:, :, 1);
filter_size_3 = 3;
filter_size_7 = 7;
filter_size_13 = 13;
@rexlow
rexlow / Lab4-TSP.c++
Last active March 7, 2018 06:11
Travelling Salesman Problem
#include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>
#include <cstdlib>
#include <chrono>
using namespace std;
// constant
const int NUM_OF_GENE = 5;
@rexlow
rexlow / rand_perm.c++
Last active February 28, 2018 10:29
Random Permutation in C++
// random_shuffle example
#include <iostream> // std::cout
#include <algorithm> // std::random_shuffle
#include <vector> // std::vector
#include <ctime> // std::time
#include <cstdlib> // std::rand, std::srand
using namespace std;
const int SIZE = 5;
@rexlow
rexlow / install.sh
Last active March 23, 2023 09:26
Enable zsh in Gcloud shell
##
# This is an adoption from Oh My Zsh for Google Cloud Shell
# author - bobvanluijt
# source - https://github.com/bobvanluijt/google-cloud-shell-pro-zsh
##
main() {
# Install zsh
sudo apt-get -qq update
@rexlow
rexlow / conda.sh
Last active February 20, 2022 07:23
Install miniconda, tensorflow, keras, theano
bash Miniconda3-latest-MacOSX-x86_64.sh
// append env path
conda install jupyter matplotlib pandas scipy Pillow scikit-learn
conda install -c conda-forge keras tensorflow
// for some reasons tensorflow installed = 1.0.0, update here