Skip to content

Instantly share code, notes, and snippets.

View gin1314's full-sized avatar

gin1314

  • SmartCharts
  • Philippines
View GitHub Profile
@gin1314
gin1314 / gist:4248228
Created December 10, 2012 03:33
PHP: CI: bootstrap pagination boilerplate code
<?php
$config = array(
'base_url' => site_url("csi_division/index"),
'total_rows' => 200,
'per_page' => 20,
'first_link' => 'First',
'first_tag_open' => '<li>',
'first_tag_close' => '</li>',
@jdowning
jdowning / vagrant-clean.sh
Last active December 13, 2021 06:59
Script to clean up Ubuntu Vagrant box before packaging
#!/bin/bash
# This script zeroes out any space not needed for packaging a new Ubuntu Vagrant base box.
# Run the following command in a root shell:
#
# bash <(curl -s https://gist.github.com/justindowning/5670884/raw/vagrant-clean.sh)
function print_green {
echo -e "\e[32m${1}\e[0m"
}
@willurd
willurd / web-servers.md
Last active April 11, 2025 12:05
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@drawveloper
drawveloper / nodejs-ubuntu-bind-port-80.md
Last active September 19, 2024 01:07
Allow Node.js to bind to privileged ports without root access on Ubuntu

How to: Allow Node to bind to port 80 without sudo

TL;DR

Only do this if you understand the consequences: all node programs will be able to bind on ports < 1024

sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/node

Important: your node location may vary. Use which node to find it, or use it directly in the command:

@shamil
shamil / mount_qcow2.md
Last active March 25, 2025 12:52
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@dtomasi
dtomasi / default
Last active February 17, 2025 02:27
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
@MightyPork
MightyPork / usb_hid_keys.h
Last active March 31, 2025 21:42
USB HID Keyboard scan codes
/**
* USB HID Keyboard scan codes as per USB spec 1.11
* plus some additional codes
*
* Created by MightyPork, 2016
* Public domain
*
* Adapted from:
* https://source.android.com/devices/input/keyboard-devices.html
*/
@thousandlemons
thousandlemons / how-to-setup-shadowsocks-on-your-ubuntu-server.md
Last active January 1, 2025 15:58
How to setup Shadowsocks on your Ubuntu server
@Birdie0
Birdie0 / ifttt-webhooks-extended-guide.md
Last active April 8, 2025 06:34
How to use Discord Webhooks

⚠️ This gist is no longer updated! For maintained, improved and even more extended guide click here.


How to use Discord Webhook

It's a JSON

First, learn JSON. It's not programming language, not even close. Just follow syntax rules and you will be fine.

@kocisov
kocisov / next_nginx.md
Last active February 3, 2025 07:27
How to setup next.js app on nginx with letsencrypt