Skip to content

Instantly share code, notes, and snippets.

View Sytten's full-sized avatar

Émile Fugulin Sytten

View GitHub Profile
@Sytten
Sytten / INSTRUCTIONS.md
Last active March 7, 2023 18:25
WaveApps Accounting

Instructions

How to extract data from Wave Apps since their export functions really suck.

Receipts

  1. Go to Settings -> Data Export -> Export all receipts as a ZIP file
  2. Download and extract the zip sent by email
  3. Remove the receipts from other years
  4. Run for file in *.png; do convert ${file} ${file%.*}.pdf; done to convert all png to pdf
  5. Run rm *.png to delete all png
@Sytten
Sytten / ulid.sql
Created June 6, 2022 03:00
ULID PL/pgSQL
CREATE EXTENSION IF NOT EXISTS pgcrypto;
CREATE OR REPLACE FUNCTION uuid_generate_ulid ()
RETURNS uuid
AS $$
DECLARE
timestamp bytea = E'\\000\\000\\000\\000\\000\\000';
unix_time bigint;
BEGIN
unix_time = (EXTRACT(EPOCH FROM clock_timestamp()) * 1000)::bigint;
@Sytten
Sytten / main.ts
Created August 19, 2020 21:11
contacts-filter
const MY_CONTACTS_GROUP_REGEX = /http:\/\/www\.google\.com\/m8\/feeds\/groups\/.+\/base\/6/
contacts = contacts.filter(contact => {
const groups = contact.gContact$groupMembershipInfo || []
return groups.some(group => MY_CONTACTS_GROUP_REGEX.test(group.href))
})
contacts = contacts.slice(0, limit + 1)
@Sytten
Sytten / main.ts
Last active August 19, 2020 21:18
contacts-extract
type Contact = {
id: {
$t: string
}
gd$name?: {
gd$givenName?: {
$t: string
}
gd$familyName?: {
$t: string
@Sytten
Sytten / main.ts
Last active August 19, 2020 21:17
contacts-request
const query = 'john'
const limit = 10
const res = await client
.request({
headers: {
'GData-Version': 3.0,
},
params: {
alt: 'json',
'max-results': 3 * limit,
@Sytten
Sytten / main.ts
Last active August 19, 2020 20:50
contacts-client
const client = new google.auth.OAuth2(
CLIENT_ID,
CLIENT_SECRET,
CALLBACK_URL
)
client.setCredentials({
access_token: "SomeAccessToken",
expiry_date: new Date('2020-08-20T10:00:00')
refresh_token: "SomeRefreshToken",
})
@Sytten
Sytten / index.php
Created May 19, 2020 01:54
failing-revenge-redirect
<?php
header("Location: https://gradeservers.ctf/[::1]:6002/grade/15/1/F");
http_response_code(307);
?>
@Sytten
Sytten / grade.py
Created May 19, 2020 01:23
failing-revenge-grades-api
class GradeApi(Resource):
@https
def patch(self, student_id, course_id, grade_score):
grade = Grade.query.filter(Grade.student_id == student_id,
Grade.course_id == course_id).first()
if grade:
grade.grade_score = grade_score
db.session.commit()
return jsonify({'status':'ok'})
return jsonify({'status':'err'})
@Sytten
Sytten / grades.html
Created May 19, 2020 01:20
failing-revenge-grades-template
{% if grade.student_name == 'Wilton Trojan' and grade.grade_score == 'F' and course_name == 'Computer Science' %}
<td class="grade_score">{{config.FLAG_TWO}}</td>
{% else %}
<td class="grade_score">{{ grade.grade_score }}</td>
{% endif %}
@Sytten
Sytten / utils.py
Created May 19, 2020 00:49
failing-revenge-api-call
def _api(endpoint):
high_school_uri = _get_school_uri()
if high_school_uri:
from frontend import legacy_http
req = legacy_http.request(request.method, f'{high_school_uri}{endpoint}')
ans = json.loads(req.output)
_err_handle(ans)
return (ans)
else:
return {'status':'err',