Skip to content

Instantly share code, notes, and snippets.

View buo's full-sized avatar

Jack Lee buo

  • Korea | Singapore
View GitHub Profile
@buo
buo / README.md
Last active May 22, 2023 06:25
PDF Cropping Script - Python Script for Cropping PDF Pages to A4 Size

PDF Cropping Script

This Python script uses the PyPDF2 library to crop PDF pages to A4 size. It allows you to specify an input PDF file and generates an output PDF file with all pages cropped to A4 dimensions.

Background

Sometimes, PDF files may contain pages that are not in the standard A4 size (595.276 x 841.890 points). This script helps you standardize the page size by cropping all pages to A4 dimensions.

Quick Start

@buo
buo / npm-update.sh
Created January 2, 2018 08:15
Update outdated NPM packages and commit the changes
#!/bin/bash
npm install
for info in $(npm outdated --parseable --depth=0);
do
pkg=$(echo "$info" | cut -d: -f4 | cut -d@ -f1)
current=$(echo "$info" | cut -d: -f3 | cut -d@ -f2)
wanted=$(echo "$info" | cut -d: -f2 | cut -d@ -f2)
{
"src_folders" : ["tests"],
"output_folder" : "reports",
"custom_commands_path" : "",
"custom_assertions_path" : "",
"page_objects_path" : "",
"globals_path" : "",
"selenium" : {
"start_process" : false,
@buo
buo / grafana-config.yml
Created July 25, 2017 08:54
Kubernetes ConfigMap for Grafana default configuration
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-config
data:
grafana.ini: |
##################### Grafana Configuration Example #####################
#
# Everything has defaults so you only need to uncomment things you want to
# change
@buo
buo / gcp-g1-small
Created July 23, 2017 04:46
UnixBench Results
========================================================================
BYTE UNIX Benchmarks (Version 5.1.3)
System: instance-2: GNU/Linux
OS: GNU/Linux -- 4.10.0-27-generic -- #30~16.04.2-Ubuntu SMP Thu Jun 29 16:07:46 UTC 2017
Machine: x86_64 (x86_64)
Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
CPU 0: Intel(R) Xeon(R) CPU @ 2.20GHz (4400.0 bogomips)
Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
04:08:47 up 4:18, 1 user, load average: 0.15, 0.09, 0.05; runlevel 5
@buo
buo / notosanskr.css
Created July 8, 2017 14:43
Noto Sans KR for Wordpress
/* Typography */
@import url(http://fonts.googleapis.com/earlyaccess/notosanskr.css);
/* Body Font */
body {
font-family: "Noto Sans KR", sans-serif !important;
}
/* Main Navigation Font */
.menu a {
@buo
buo / init_jupyter.sh
Created August 24, 2016 07:59
A script that automatically configures Jupyter on Cloud9
#!/bin/bash
sudo pip install jupyter
jupyter notebook --generate-config
sed -i "s/# c.NotebookApp.port = 8888/c.NotebookApp.port = $PORT/" ~/.jupyter/jupyter_notebook_config.py
sed -i "s/# c.NotebookApp.ip = 'localhost'/c.NotebookApp.ip = '0.0.0.0'/" ~/.jupyter/jupyter_notebook_config.py
@buo
buo / README.md
Last active January 28, 2020 16:17
An example script to take a screenshot of web page with PhantomJS

Basic

#!/usr/bin/env ruby
# encoding: utf-8
require 'net/http'
def available?(username)
uri = URI('https://github.com/signup_check/username')
res = Net::HTTP.post_form(uri, :value => username)
puts res.body
@buo
buo / spoof-mac.fish
Created September 4, 2015 21:43
Fish completion for [SpoofMAC](http://feross.org/spoofmac/)
function __fish_spoof_mac_needs_command
set cmd (commandline -opc)
if [ (count $cmd) -eq 1 ]
return 0
end
return 1
end
function __fish_spoof_mac_using_command
set cmd (commandline -opc)