Skip to content

Instantly share code, notes, and snippets.

https://drive.google.com/file/d/1doYh3JOQR0w1D-gbdR9NHRNkBAl42IN7/view?usp=drivesdk
@sonnyksimon
sonnyksimon / coding-timecomplexity.txt
Created September 1, 2019 21:18
Always check the time complexity when coding.
Always check the time complexity when coding.
Python: https://wiki.python.org/moin/TimeComplexity
JavaScript: https://www.freecodecamp.org/news/the-complexity-of-simple-algorithms-and-data-structures-in-javascript-11e25b29de1e/
@sonnyksimon
sonnyksimon / unlock-oracle-apex-admin-user.txt
Created September 7, 2019 23:08
Unlock an Oracle APEX admin user (when apxchpwd.sql doesn't work)
1. Find the userId.
select user_id from APEX_040200.WWV_FLOW_FND_USER where user_name = 'ADMIN' order by last_update_date desc;
2. Set a new password.
update APEX_040200.WWV_FLOW_FND_USER
set web_password = 'password'
where user_name = 'ADMIN'
and user_id = 56502607595642;
@sonnyksimon
sonnyksimon / reddit.html
Last active September 15, 2019 03:27
reddit.html
<html>
<head>
<meta http-equiv="Content-Type" name="text/html; charset=UTF-8">
<title>reddit - what's new online</title>
<script src="/static/prototype.js" language="javascript" type="text/javascript"></script>
<script language="javascript"><% if logged_in_p %>var logged = true<% else %>var logged = false<% endif %></script>
<script src="/static/logic.js" language="javascript" type="text/javascript"></script>
<link rel="stylesheet" href="/static/styles.css" type="text/css">
<link rel="shortcut icon" href="/static/favicon.ico">
<% if rss_url %><link rel="alternate" type="text/xml" title="RSS" href={{rss_url}}><% endif %></head>
@sonnyksimon
sonnyksimon / sdrem
Created September 25, 2019 16:04
~/bin/sdrem
#!/usr/bin/env python
from __future__ import print_function
import datetime
if __name__ == '__main__':
at = datetime.datetime(1986,11,8)
st = datetime.datetime(1997,11,15)
sn = datetime.datetime.now()
ad = datetime.datetime(2013,1,11)
print(str( ad - sn + st - at ))
@sonnyksimon
sonnyksimon / hello.py
Created October 10, 2019 14:16
A complete Flask application.
import flask
app = flask.Flask(__name__)
@app.route('/', defaults={'path': ''})
@app.route('/<name>')
def hello(name):
if not name:
name = 'World'
return 'Hello ' + name + '!'
@sonnyksimon
sonnyksimon / javascript.js
Last active March 13, 2020 17:48
Reduce a list of users and a list of roles for each user into a single unified listing of users.
const data = JSON.parse(`{
"users": [
{
"id": 1,
"name": "basicuser"
},
{
"id": 2,
"name": "adminuser"
}
@sonnyksimon
sonnyksimon / uol.txt
Last active February 24, 2020 22:45
Su Mo Tu We Th Fr Sa
Feb 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29 you are here
Mar 1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21 lv4 & lv5 cw2 due
22 23 24 25 26 27 28
@sonnyksimon
sonnyksimon / split_years_to_months.py
Last active October 20, 2019 23:16
split_years_to_months.py
import datetime
import calendar
import re
def last_day_of_month(date):
return date.replace(day=31) if date.month == 12 else date.replace(month=date.month+1, day=1) - datetime.timedelta(days=1)
def format_date(date):
return date.strftime("%Y-%m-%dT%H:%M:%S.%fZ")
@sonnyksimon
sonnyksimon / README.md
Last active March 13, 2020 17:47
content mapping in jq :: the filter maps each post to its slug, and the reverse filter reverts it

content mapping in jq :: the filter maps each post to its slug, and the reverse filter reverts it