Skip to content

Instantly share code, notes, and snippets.

View jonluca's full-sized avatar

JonLuca De Caro jonluca

View GitHub Profile
@jonluca
jonluca / functions.zsh
Created September 11, 2018 17:11
Bash/Zsh Kill Port
kill_by_port{
lsof -i ":${1}" | awk 'NR > 1 {print $2}' | xargs kill -9
}
@jonluca
jonluca / NintendoSystemVersionTable.csv
Last active April 10, 2023 03:04
Nintendo Switch Fuse Blown Count
System version Expected number of burnt fuses (retail) Expected number of burnt fuses (non-retail)
1.0.0 1 0
2.0.0-2.3.0 2 0
3.0.0 3 1
3.0.1-3.0.2 4 1
4.0.0-4.1.0 5 1
5.0.0-5.1.0 6 1
6.0.0-6.1.0 7 1
6.2.0 8 1
7.0.0-8.0.1 9 1
@jonluca
jonluca / lazyload.js
Last active March 23, 2018 01:28
Lazy Load
$(document).ready(function() {
$("#about").click(function() {
$('#about > .lazyload').each(function() {
// set the img src from data-src
$(this).attr('src', $(this).attr('data-src'));
});
});
$("#articles").click(function() {
$('#articles > .lazyload').each(function() {
server {
listen 443 ssl http2;
server_name jonlu.ca www.jonlu.ca;
root /var/www/html;
index index.html index.htm;
location ~ /.git/ {
deny all;
@jonluca
jonluca / nginx.conf
Last active April 6, 2018 06:48
Nginx Conf
worker_processes auto;
pid /run/nginx.pid;
worker_rlimit_nofile 30000;
events {
worker_connections 65535;
multi_accept on;
use epoll;
}
@jonluca
jonluca / webpack.config.js
Last active March 20, 2018 02:09
Webpack Config
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const ZopfliPlugin = require("zopfli-webpack-plugin");
module.exports = {
entry: './js/app.js',
mode: 'production',
output: {
path: __dirname + '/dist',
filename: 'bundle.js'
},
@jonluca
jonluca / nginx.conf
Last active March 16, 2018 21:47
HTTPS Nginx Config
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name jonlu.ca www.jonlu.ca;
root /var/www/html;
index index.html index.htm;
location ~ /.git {
deny all;
@jonluca
jonluca / nginx.conf
Last active March 16, 2018 21:47
Original Nginx Config
server{
listen 80;
server_name jonlu.ca www.jonlu.ca;
root /var/www/html;
index index.html index.htm;
location ~ /.git/ {
deny all;
}
location ~ / {
@jonluca
jonluca / TestingMaxPlusOne.cpp
Last active March 15, 2018 04:36
Test Max Plus One
#define MAX_SET_TO_ONE 1000
int mVar = 0;
int mTimesSetToOne = 0;
void setVarToOne(int* mVar){
if(mVar && mTimesSetToOne < MAX_SET_TO_ONE){
*mVar = 1;
mTimesSetToOne++;
}
@jonluca
jonluca / TestMax.cpp
Created March 15, 2018 04:21
Test Max
int mVar = INT_MAX;
void setVarToOne(int* mVar){
if(mVar) *mVar = 1;
}
setVarToOne(&mVar);
ASSERTEQ(mVar,1); //true