Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @name Fetch Order Information
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://live02.168money.com.tw/center/orders/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=168money.com.tw
// @grant none
// ==/UserScript==
@seanmars
seanmars / JavaScript.Magic.js
Created December 23, 2021 08:36 — forked from ufocoder/JavaScript.Magic.js
JavaScript Magic
/*******************************************
*
* Javascript Magic Page
*
* Author: Sergey Ivanov <xufocoder@gmail.com>
*
* (\_/)
* (=':'=)
* ▀▀▀███████▀▀▀
* ███████
@seanmars
seanmars / script-template.sh
Created December 28, 2020 02:05 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@seanmars
seanmars / main.js
Last active October 12, 2020 07:38
const express = require('express')
const app = express()
const port = 3000
const delay = (s) => {
return new Promise(resolve => {
setTimeout(resolve, s);
});
}
@seanmars
seanmars / location.js
Created May 22, 2020 07:03
How to detect the location of your website's users with Javascript for free?
//regular expressions to extract IP and country values
const countryCodeExpression = /loc=([\w]{2})/;
const userIPExpression = /ip=([\w\.]+)/;
//automatic country determination.
function initCountry() {
return new Promise((resolve, reject) => {
var xhr = new XMLHttpRequest();
xhr.timeout = 3000;
xhr.onreadystatechange = function () {
2018-06-05 10:51:05.4448 Info Message Template Auto Format enabled
2018-06-05 10:51:05.4448 Info Loading assembly: NLog.Web.AspNetCore
2018-06-05 10:51:05.4448 Debug ScanAssembly('NLog.Web.AspNetCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c')
2018-06-05 10:51:05.4629 Trace FindReachableObject<NLog.Internal.IRenderable>:
2018-06-05 10:51:05.4629 Trace Scanning BaseDirLayoutRenderer 'Layout Renderer: ${basedir}'
2018-06-05 10:51:05.4629 Trace FindReachableObject<NLog.Internal.IRenderable>:
2018-06-05 10:51:05.4733 Trace Scanning LongDateLayoutRenderer 'Layout Renderer: ${longdate}'
2018-06-05 10:51:05.4733 Debug Setting 'EventPropertiesLayoutRenderer.item' to 'EventId_Id'
2018-06-05 10:51:05.4733 Trace FindReachableObject<NLog.Internal.IRenderable>:
2018-06-05 10:51:05.4733 Trace Scanning EventPropertiesLayoutRenderer 'Layout Renderer: ${event-properties}'
@seanmars
seanmars / beautiful_idiomatic_python.md
Created July 7, 2017 14:01 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]: