Skip to content

Instantly share code, notes, and snippets.

View scomma's full-sized avatar
🧠
Training neural network

Prathan Thananart scomma

🧠
Training neural network
View GitHub Profile
@scomma
scomma / postcode.rb
Created August 4, 2020 07:14
Postcodes
BANGKOK = [
10100, 10101, 10102, 10103, 10200, 10201, 10202,
10203, 10204, 10205, 10206, 10120, 10121, 10122,
10123, 10124, 10125, 10330, 10331, 10332, 10333,
10500, 10501, 10503, 10504, 10506, 10110, 10111,
10112, 10113, 10114, 10115, 10116, 10117, 10250,
10251, 10253, 10254, 10260, 10261, 10262, 10263,
10264, 10140, 10141, 10150, 10151, 10152, 10310,
10311, 10320, 10321, 10323, 10324, 10325, 10326,
10340, 10341, 10342, 10400, 10401, 10402, 10403,
@scomma
scomma / slow.log
Last active December 2, 2019 11:01
[107] production(main)> app.get 'https://page365.net/Jade4you9/products.json', god_token: '9uctTgwj8pvixpXtbN66Drro3LTuAMpG'
D, [2019-12-02T16:35:53.535756 #25736] DEBUG -- : Account Load (11.8ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`username` = 'Jade4you9' LIMIT 1
D, [2019-12-02T16:35:53.679421 #25736] DEBUG -- : (124.7ms) SELECT COUNT(*) FROM `products` WHERE `products`.`account_id` = 303359
D, [2019-12-02T16:35:53.688800 #25736] DEBUG -- : Product Load (2.4ms) SELECT `products`.* FROM `products` WHERE `products`.`account_id` = 303359 ORDER BY `products`.`id` DESC LIMIT 50 OFFSET 0
D, [2019-12-02T16:35:53.737452 #25736] DEBUG -- : HABTM_Photos Load (1.6ms) SELECT `photos_products`.* FROM `photos_products` WHERE `photos_products`.`product_id` IN (68810370, 68810364, 68806072, 68805871, 68805870, 68805869, 68799593, 68799297, 68788870, 68788869, 6
8788322, 68788310, 68787671, 68787670, 68787669, 68787668, 68787667, 68787663, 68787662, 68787661, 68787594, 68787332, 68787304, 68
@scomma
scomma / quick_triage.user.js
Created March 12, 2019 09:38
Quick Triage
// ==UserScript==
// @name Quick Triage
// @namespace https://softbaked.co/
// @version 0.1
// @description Quickly triage Maniphest tasks
// @author You
// @match https://softbaked.co/*
// @require https://cdnjs.cloudflare.com/ajax/libs/mousetrap/1.6.1/mousetrap.js
// @require https://raw.githubusercontent.com/ccampbell/mousetrap/master/plugins/global-bind/mousetrap-global-bind.js
// ==/UserScript==
@scomma
scomma / tampermonkey_scripts.txt
Created October 19, 2018 09:25
Maniphest Quick Triage for Tampermonkey
{"created_by":"Tampermonkey","version":"1","scripts":[{"name":"Quick Triage","options":{"check_for_updates":true,"comment":null,"compatopts_for_requires":true,"compat_wrappedjsobject":false,"compat_metadata":false,"compat_foreach":false,"compat_arrayleft":false,"compat_uW_gmonkey":false,"compat_forvarin":false,"noframes":null,"awareOfChrome":false,"run_at":null,"override":{"use_includes":[],"orig_includes":[],"merge_includes":true,"use_matches":[],"orig_matches":["http://softbaked.co/*"],"merge_matches":true,"use_excludes":[],"orig_excludes":[],"merge_excludes":true,"use_connects":[],"merge_connects":true,"use_blockers":[],"orig_run_at":"document-idle","orig_noframes":null,"orig_connects":[]}},"storage":{"ts":1513744916648,"data":{}},"enabled":true,"position":1,"uuid":"8ff81db7-8771-4213-bb0e-98da3ab3e721","source":"Ly8gPT1Vc2VyU2NyaXB0PT0KLy8gQG5hbWUgICAgICAgICBRdWljayBUcmlhZ2UKLy8gQG5hbWVzcGFjZSAgICBodHRwOi8vc29mdGJha2VkLmNvLwovLyBAdmVyc2lvbiAgICAgIDAuMQovLyBAZGVzY3JpcHRpb24gIFF1aWNrbHkgdHJpYWdlIE1hbmlwaGVz
exports.dispatch = (req, res) ->
# Facebook's challenge
if req.query['hub.mode'] == 'subscribe' and \
req.query['hub.verify_token'] == 'c2f18de9'
return res.status(200).send req.query['hub.challenge']
# Actual webhooks
if req.body.object == 'page'
for entry in req.body.entry
for e in entry.messaging
@scomma
scomma / templates_controller.rb
Created March 30, 2013 10:59
Page-caching thoughtbot's excellent high_voltage
class TemplatesController < HighVoltage::PagesController
caches_page except: []
skip_before_filter :authenticate_user!
layout false
end
@scomma
scomma / Capfile
Created February 9, 2013 04:44
Run an interactive console session on a production machine with Capistrano.
require 'bundler/capistrano'
set :bundle_flags, "--deployment --binstubs"
set :default_environment, 'PATH' => '$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH'
role :web, "your.ip.here"
set :user, "passenger"
namespace :rails do
desc "Remote console"
task :console, roles: :app do
@scomma
scomma / plankton.py
Created November 28, 2012 10:49
Transparent Lightweight HTTP Traffic Logging with tcpdump
#!/opt/bin/python2.7
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
import re, datetime, subprocess
INTERFACE = 'br0'