Skip to content

Instantly share code, notes, and snippets.

@iAladdin
iAladdin / GotchaYouriPhoneX.js
Last active December 6, 2021 10:19
Gotcha Your iPhone X
var rp = require('request-promise');
var moment = require('moment');
var storesURL = function(localtion){
return 'https://reserve-prime.apple.com/'+localtion+'/zh_'+localtion+'/reserve/iPhoneX/stores.json';
}
var availabilityURL = function(localtion){
return 'https://reserve-prime.apple.com/'+localtion+'/zh_'+localtion+'/reserve/iPhoneX/availability.json';
};
@iAladdin
iAladdin / a.sh
Created May 22, 2020 06:26
compress encode and split a bulk file to many slices; sh a.sh filePath; sh m.sh filePath-ts-ala;
#!/bin/
name=$1
if [[ -n "$name" ]]; then
target="$( date +%s )"
encTarget="$name-$target.ala"
splitTargetPrefix="$name-$target.ala-"
tar -czvf $target $name
openssl des -in $target -out $encTarget
@iAladdin
iAladdin / wwdc-2014-extractor
Last active April 26, 2019 01:27
WWDC 2014 Sessions Video URL Extractor
//please execute this script on https://developer.apple.com/videos/wwdc/2014/
//inspect this page and run it on console
jQuery(".download a:contains('HD')").each(function(n){ console.log(jQuery(this).attr("href"))})
jQuery(".download a:contains('SD')").each(function(n){ console.log(jQuery(this).attr("href"))})
jQuery(".download a:contains('PDF')").each(function(n){ console.log(jQuery(this).attr("href"))})
#!/bin/bash
# --- Version history ---
# track cpu usage all the time. $1 is logfile name.
# --- Version history ---
# Usage: cputrack [PID] [filename]
# replace [PID] with process ID #
# replace [filename] with base file name to use (no extension)
filepath=/Users/ialaddin # modify as desired
interval=20 # reports per minute
timelimit=6000 # how long to run, in seconds
@iAladdin
iAladdin / setproxy
Last active July 17, 2018 06:41 — forked from beradrian/setproxy
Set proxy for npm and git
# set a proxy
export HTTP_PROXY=
export HTTPS_PROXY=$HTTP_PROXY
npm config set proxy $HTTP_PROXY
npm config set https.proxy $HTTPS_PROXY
npm config set https-proxy $HTTPS_PROXY
git config --global http.proxy $HTTP_PROXY
git config --global https.proxy $HTTPS_PROXY
# unset proxy
@iAladdin
iAladdin / apps.md
Last active March 28, 2018 04:13
apps for new Mac
#!/usr/bin/env bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#=================================================
# System Required: CentOS 6+/Debian 6+/Ubuntu 14.04+
# Description: Install the ShadowsocksR server
# Version: 2.0.23
# Author: Toyo
# Blog: https://doub.io/ss-jc42/
@iAladdin
iAladdin / PrettyPrint.swift
Created October 8, 2017 14:16
Swift 4 - PrettyPrint
//
// PrettyPrint.swift
//
// Created by Aladdin on 08/10/2017.
// Copyright © 2017 Aladdin. All rights reserved.
//
import Foundation
public func prettyprint<T>(_ object: T, _ file: String = #file, _ function: String = #function, _ line: Int = #line) {
Swift.print("\(file.lastPathComponent):\(line) - \(function) | \(object)")
@iAladdin
iAladdin / index.html
Created April 12, 2017 09:41 — forked from d3noob/.block
Collapsible tree diagram in v4
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.node circle {
fill: #fff;
stroke: steelblue;
stroke-width: 3px;
}