Skip to content

Instantly share code, notes, and snippets.

View cupnoodle's full-sized avatar

soulchild cupnoodle

View GitHub Profile
@cupnoodle
cupnoodle / nginx.conf
Created March 7, 2016 10:02
Port 80 part of Nginx config
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
@cupnoodle
cupnoodle / nginx.conf
Last active July 17, 2016 14:13
Nginx config with SSL
listen 443 ssl;
server_name [your_domain] www.[your_domain];
ssl_certificate /etc/letsencrypt/live/[your_domain]/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/[your_domain]/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
@cupnoodle
cupnoodle / nginx.conf
Last active March 8, 2016 08:08
Redirect http traffic to https in Nginx
server {
listen 80;
server_name [your_domain] www.[your_domain];
return 301 https://$host$request_uri;
}
@cupnoodle
cupnoodle / nginx.conf
Last active April 1, 2016 07:28
Complete HTTPS configuration with auto http redirect to https
# https server block
server {
listen 443 ssl;
server_name [your_domain] www.[your_domain];
ssl_certificate /etc/letsencrypt/live/[your_domain]/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/[your_domain]/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
@cupnoodle
cupnoodle / 0_reuse_code.js
Created June 5, 2016 09:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@cupnoodle
cupnoodle / nginx.conf
Created June 5, 2016 13:21
Nginx configuration file to serve Rails app using Passenger
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@cupnoodle
cupnoodle / post-receive
Last active July 19, 2016 03:45
Post receive hook which runs deploy task after receiving push, remember to set chmod +x and grant the deploy user nopasswd.
#!/bin/bash -l
#The -l parameter executes the command in a login shell
GIT_DIR=/path/to/repo/of/awesomeapp.git
WORK_TREE=/path/to/awesomeapp
while read oldrev newrev ref
do
@cupnoodle
cupnoodle / ExpandableTableViewController.m
Created June 21, 2016 09:55
Expandable/Shrinkable table view cell in Objective-C
//
// ViewController.m
// stampCard
//
// Created by soulchild on 21/06/2016.
// Copyright © 2016 Sweatshop. All rights reserved.
//
#import "ViewController.h"
#import "CardTableViewCell.h"
@cupnoodle
cupnoodle / mechanize_user_agent.rb
Created July 7, 2016 15:44
Random legit user agent when web scraping
agent = Mechanize.new
# randomly choose one user agent aside from Mechanize itself
agent.user_agent = Mechanize::AGENT_ALIASES[(Mechanize::AGENT_ALIASES.keys - ['Mechanize']).sample]
@cupnoodle
cupnoodle / constantCookieValue.js
Created July 7, 2016 16:07
Setting constant cookie value check by UTAR WBLE lulz
document.cookie = 'scraperCheck=1; Fri, 22 April 2016 20:47:11 UTC; path=/'