Skip to content

Instantly share code, notes, and snippets.

View altbdoor's full-sized avatar
🐵

Ng Han Seng altbdoor

🐵
  • Kuala Lumpur, Malaysia
  • 16:05 (UTC +08:00)
View GitHub Profile
@altbdoor
altbdoor / LICENSE
Last active October 4, 2022 12:47
Manually generating an Angular SCAM
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@altbdoor
altbdoor / fix.sh
Created October 24, 2021 14:57
Manually getting the date in filename with awk
#!/bin/bash
CURRENT_DIR="$( cd "$(dirname "${BASH_SOURCE[0]}")" && pwd )"
cd "$CURRENT_DIR"
workpath="$1"
cd "${workpath}"
for image in *.jpeg; do
date_format=$(echo "${image}" | awk '{gsub(/-/, ":", $3); print $3}')
@altbdoor
altbdoor / example.reducer.ts
Last active January 10, 2020 07:22
Proposed basis of NgRx reducer files
import { Action, createReducer, on } from '@ngrx/store';
export const featureKey = 'niceFeature';
export interface State {}
export const initialState: State = {};
const reducerFn = createReducer(
initialState,
@altbdoor
altbdoor / install_node.sh
Last active May 10, 2022 07:02
Install nodejs to home directory
#!/bin/bash
# install via
# bash <(curl -L 'https://gist.githubusercontent.com/altbdoor/9c801dcad5f11352e3dc346ba9ebaf9c/raw/install_node.sh')
default_version="14"
node_regexp='node-v.+?-linux-x64.tar.xz'
read -p "Enter desired major version, or leave blank for latest-v${default_version}.x: " node_version
@altbdoor
altbdoor / stat.py
Created September 29, 2018 14:57
Python script to do some chat analytics
import datetime
import os
import re
import urllib.error
import urllib.request
def download_log_files(date_obj):
today = datetime.datetime.now()
today = today.replace(hour=0, minute=0, second=0, microsecond=0)
@altbdoor
altbdoor / ocr_convertio.sh
Created August 18, 2018 04:45
OCR image containing Chinese text with Convertio API
#!/bin/bash
echo "making request"
make_req_data=$(cat <<JSONDATA
{
"apikey": "__insert api key__",
"input": "upload",
"outputformat": "txt",
"options": {
"ocr_enabled": true,
@altbdoor
altbdoor / insta_tag_analysis.py
Created August 17, 2018 14:22
Basic tag analysis, generates CSV of tags over time
#!/usr/bin/env python
import datetime
import json
import sys
import time
import urllib.request
tag = 'shutteredco'
base_url = 'https://www.instagram.com/explore/tags/' + tag + '/?__a=1'
@altbdoor
altbdoor / node_sass_patch.diff
Last active July 29, 2018 03:46
Fix 'unreadable file error' for node-sass
Original from: https://github.com/sass/node-sass/pull/2386
https://github.com/marcosbozzani/node-sass/commit/266861b.diff
Modified to include exponential backoff
--- render.js.bak 2018-07-28 22:33:12.784523700 +0800
+++ render.js 2018-07-29 11:42:15.442878400 +0800
@@ -42,11 +42,13 @@
renderOptions.file = options.src;
}
+ var retries = 0;
@altbdoor
altbdoor / README.md
Last active June 10, 2023 01:37
Sublime Text 3 plugin to automatically close purchase pop up on save
@altbdoor
altbdoor / magic.py
Last active April 26, 2018 10:39
Some odd day to day implementation for a certain client on some date calculation stuff
#!/bin/usr/env python
import calendar
import datetime
max_month = 5
start_date = datetime.datetime(2018, 2, 28)
copy_start_date = start_date