Skip to content

Instantly share code, notes, and snippets.

View defong's full-sized avatar
🎯
Focusing

De Fong defong

🎯
Focusing
View GitHub Profile
@defong
defong / pre-compress-web-assets
Created April 21, 2017 15:44 — forked from rabin-io/pre-compress-web-assets
Recursively pre-compress (gzip) CSS/JavaScript/webfont assets for use Nginx and the HttpGzipStaticModule module.
#!/bin/bash
###########################################################################
# Usage:
# pre-compress-web-assets [.|folder_name]
#
# This script will recursively look for the files in the $ext variable
# and compress/re-compress them.
#
# By default it will look into the current working folder,
@defong
defong / arch-linux-install
Last active February 2, 2019 21:51 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@defong
defong / ssl_puma.sh
Created May 22, 2020 09:57 — forked from tadast/ssl_puma.sh
[RoR] localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@defong
defong / [DfE] 3507-financial-support-section-displaying-incorrect-information-for-provider.rb
Last active June 11, 2020 08:32
[DfE] 3507-financial-support-section-displaying-incorrect-information-for-provider.rb
issues = RecruitmentCycle.current.courses.with_funding_types(["apprenticeship"]).distinct
xxxx = issues.map do |c|
provider_code = c.provider.provider_code
course__findable = c.findable?
find_url = course__findable ? "https://www.find-postgraduate-teacher-training.service.gov.uk/course/#{provider_code}/#{c.course_code}" : ""
pub_url = "https://www.publish-teacher-training-courses.service.gov.uk/organisations/#{provider_code}/2020/courses/{c.course_code}"
@defong
defong / recent-activity.txt
Last active October 17, 2022 19:50
activity
🎉 Merged PR #3048 in DFE-Digital/publish-teacher-training
🗣 Commented on #1524 in DFE-Digital/find-teacher-training
🎉 Merged PR #1526 in DFE-Digital/find-teacher-training
🎉 Merged PR #1523 in DFE-Digital/find-teacher-training
🎉 Merged PR #1514 in DFE-Digital/find-teacher-training
@defong
defong / subjects.rb
Last active November 4, 2020 10:52
[DfE] subjects list
SUBJECTS = [
{:name=>"Primary", :level=>:primary},
{:name=>"Primary with English", :level=>:primary},
{:name=>"Primary with geography and history", :level=>:primary},
{:name=>"Primary with mathematics", :level=>:primary},
{:name=>"Primary with modern languages", :level=>:primary},
{:name=>"Primary with physical education", :level=>:primary},
{:name=>"Primary with science", :level=>:primary},
{:name=>"Art and design", :level=>:secondary},
{:name=>"Science", :level=>:secondary},
@defong
defong / [DfE] lead_school.rb
Created February 24, 2021 11:52
[DfE] lead_school.rb
items = (RecruitmentCycle.current.providers.lead_school.map do |p|
p.users.non_admins.map do |u|
{
provider_name: p.provider_name,
email: u.email,
}
end
end).flatten
items = Allocation.where(recruitment_cycle_id: RecruitmentCycle.current).map do |a |
{
accredited_body_code: a.accredited_body_code,
accredited_body_name: a.accredited_body.provider_name,
provider_code: a.provider_code,
provider_name: a.provider.provider_name,
confirmed_number_of_places: a.confirmed_number_of_places,
request_type: a.request_type,
number_of_places: a.number_of_places,
url: "https://qa.publish-teacher-training-courses.service.gov.uk/organisations/#{a.accredited_body_code}/2021/allocations",
@defong
defong / [DfE] pe_allocations.rb
Last active August 26, 2021 11:08
[DfE] pe_allocations.rb
#######
# This is the latest (previous courses)
# flatten exploded courses over allocations + leftover allocations
# to use rails c
# copy and paste dump tip
#######
courses = Subject.find_by(subject_code: "C6").courses.with_recruitment_cycle(RecruitmentCycle.next.year).with_funding_types(["fee"])
@defong
defong / [images] sizing.sh
Last active October 25, 2021 13:37
[images] sizing
convert "1000 trainees.gif" -coalesce "coalesce/1000 trainees.gif"
convert "coalesce/1000 trainees.gif" -trim +repage -resize '640x320>' -gravity center -background transparent -extent 640x320 "cropped/1000 trainees.gif"