Skip to content

Instantly share code, notes, and snippets.

View gin1314's full-sized avatar

gin1314

  • SmartCharts
  • Philippines
View GitHub Profile
@gin1314
gin1314 / next_nginx.md
Created March 6, 2021 17:13 — forked from kocisov/next_nginx.md
How to setup next.js app on nginx with letsencrypt

How to setup next.js app on nginx with letsencrypt

next.js, nginx, reverse-proxy, ssl

1. Install nginx and letsencrypt

$ sudo apt-get update
$ sudo apt-get install nginx letsencrypt

Also enable nginx in ufw

package main
import "fmt"
import "strconv"
const (
MAX_X = 20
MAX_Y = 20
)
#!/bin/bash
for i in {1..10}
do
rand=$(( ( RANDOM % 4000 ) + 6000 ))
curl -X GET "http://localhost:8000/broadcast/test/$rand" &2> /dev/null
echo -e "$rand"
sleep 3
done
@gin1314
gin1314 / simulate_watch.sh
Created March 18, 2017 08:50
bash: simulate `watch` command
#!/bin/bash
while true; do; ls -la . | tr -d '\r\n'; echo -n "\r"; sleep 5; done
#!/usr/bin/env python
# @author: eugene.santos13@gmail.com
# this will generate json structure for .shuttle.json
import json
import sys, getopt
def parse_opt(argv):
cert_path = ''
@gin1314
gin1314 / iterm2-solarized.md
Created June 3, 2016 06:44 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + oh my zsh + solarized + Meslo powerline font (OSX)

Solarized

@gin1314
gin1314 / gist:acdb5c937bfcc75ab8cc
Created August 3, 2015 10:28
linux: example of enabling IP forwarding and redirection
sysctl -w net.ipv4.ip_forward=1
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8080
@gin1314
gin1314 / gist:a7d78fb318264c109137
Created July 30, 2015 11:47
ffmpeg recipe for mobile video
“Standard” web video (480p at 500kbit/s):
ffmpeg -i input_file.avi -vcodec libx264 -vprofile high -preset slow -b:v 500k -maxrate 500k -bufsize 1000k -vf scale=-1:480 -threads 0 -acodec libvo_aacenc -b:a 128k output_file.mp4
360p video for older mobile phones (360p at 250kbit/s in baseline profile):
ffmpeg -i inputfile.avi -vcodec libx264 -vprofile baseline -preset slow -b:v 250k -maxrate 250k -bufsize 500k -vf scale=-1:360 -threads 0
-acodec libvo_aacenc -ab 96k output.mp4
480p video for iPads and tablets (480p at 400kbit/s in main profile):
@gin1314
gin1314 / gist:74f7513eabd91eb16868
Created July 10, 2015 09:45
css: custom checkbox using :checked pseudo class
<div class="checkbox">
<label for="checkbox-1">
<input type="checkbox" name="box[1]" id="checkbox-1" checked>
Checkbox
<div class="checkbox-ui"></div>
</label>
</div>
<div class="checkbox">
<label for="checkbox-2">
$ ./script/server
=> Booting Mongrel
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:in `requirement': undefined local variable or method `version_requirements' for #<Rails::GemDependency:0xf6e64a78> (NameError)
from /usr/local/lib/site_ruby/1.8/rubygems.rb:254:in `activate'
from /usr/local/lib/site_ruby/1.8/rubygems.rb:1204:in `gem'
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:73:in `add_load_paths'
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:301:in `add_gem_load_paths'
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:301:in `each'
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:301:in `add_gem_load_paths'