Skip to content

Instantly share code, notes, and snippets.

View randomradio's full-sized avatar
🎯
Focusing

i.an randomradio

🎯
Focusing
View GitHub Profile
@randomradio
randomradio / nginx.conf
Created May 30, 2023 07:27 — forked from nrollr/nginx.conf
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration
@randomradio
randomradio / nginx.conf
Created May 30, 2023 07:27 — forked from nrollr/nginx.conf
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration
@randomradio
randomradio / .tmux.conf
Last active February 18, 2019 07:10
tmux configuration. Vim styled keybinding.
# 0 is too far from ` ;)
set -g base-index 1
# reset keys
unbind-key -n S-Left
unbind-key -n S-Right
# custom binding
set -g prefix C-s
bind C-s send-prefix
@randomradio
randomradio / cleaner_v2.py
Last active July 9, 2018 05:54
Google document cleanup
import bs4
import cssutils
import logging
import urlparse
class HTML_cleaner(object):
soup = None;
highlighting_selectors = {}
@randomradio
randomradio / README.md
Created April 11, 2018 22:16
batch remove github repository

Bulk delete repositories, keep your github sane and remind you how many undone project you hoarded.

Delete all repos

  1. repos.txt contains a list of repository names in {UserName}/{RepoName} format, e.g. IanZhao/to-be-deleted. use this file to track all repositories you want to delete.
  2. Open fetchSaveRepo.js and update url with your github username.
  3. you need node-fetch to fetch contents, just do a npm init with default settings and run npm install node-fetch.
  4. run node fetchSaveRepo.js
  5. Generate a Authorization Token for repo delete access token
  6. Copy the token and put in in place TOKEN_HERE in deleteRepos.sh
@randomradio
randomradio / gist:ccdfc55ddffbaf022f9d0c34f2760b3e
Created August 10, 2017 16:39 — forked from GrahamDumpleton/gist:b380652b768e81a7f60c
Setting environment variables for Apache/mod_wsgi hosted Python application.

Django documentation says to use:

WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py
WSGIPythonPath /path/to/mysite.com

<Directory /path/to/mysite.com/mysite>
<Files wsgi.py>
Require all granted

Difference between Debounce and Throttle

Debounce

Debounce a function when you want it to execute only once after a defined interval of time. If the event occurs multiple times within the interval, the interval is reset each time.
Example A user is typing into an input field and you want to execute a function, such as a call to the server, only when the user stops typing for a certain interval, such as 500ms.

Throttle

Difference between Debounce and Throttle

Debounce

Debounce a function when you want it to execute only once after a defined interval of time. If the event occurs multiple times within the interval, the interval is reset each time.
Example A user is typing into an input field and you want to execute a function, such as a call to the server, only when the user stops typing for a certain interval, such as 500ms.

Throttle

@randomradio
randomradio / sublime-text-3-setup.md
Created March 30, 2017 17:24 — forked from ijy/sublime-text-3-setup.md
My Sublime Text 3 setup.

Sublime Text 3 Setup

Install Package Control

Install Package Control for easy package management.

  1. Open the console with Ctrl+`
  2. Paste in the following:
@randomradio
randomradio / gitignore
Created March 20, 2017 16:59
my gitignore for node/python/virtualenv/golang/osx
# Compiled Python files
*.pyc
# Folder view configuration files
.DS_Store
Desktop.ini
# Thumbnail cache files
._*
Thumbs.db