Skip to content

Instantly share code, notes, and snippets.

View kenshinji's full-sized avatar
🎯
Focusing

Fred Wang kenshinji

🎯
Focusing
View GitHub Profile
@emiller42
emiller42 / ghost
Created October 28, 2013 04:44
init.d script to run Ghost under a service account.
#!/bin/sh
#
# chkconfig: 35 99 99
# description: Node.js /home/ghost/ghost/index.js
#
. /etc/rc.d/init.d/functions
USER="ghost"
@thomasfr
thomasfr / autossh.service
Last active November 18, 2024 03:37
Systemd service for autossh
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)
@hikerpig
hikerpig / qiandao_casper.coffee
Last active May 22, 2017 14:40
用casperjs暴力签到虾米。
utils = require('utils')
fs = require('fs')
casper = require("casper").create(
verbose: true
logLevel: "warning" # 想看更详细的log的话可以改成"debug"
pageSettings:
loadImages: false
loadPlugins: false
userAgent: "Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0"
@jeffjohnson9046
jeffjohnson9046 / sinatra-server.rb
Last active October 1, 2024 07:34
A simple sinatra server that accepts a POST with JSON content.
# To make this server publicly available on the inter-webs while running from localhost, use ngrok, which can be found here:
# https://ngrok.com/download. Follow the installation instructions for ngrok and start it up:
#
# ./ngrok 4567 # (or whatever port you want to listen on).
#
# ngrok will spit out an ugly but unique URL. After ngrok starts up, you should be able to POST to the sinatra server:
#
# http://6eee766f.ngrok.com/payload
require 'sinatra'
require 'json'
@IzumiSy
IzumiSy / manifest.json
Last active August 16, 2024 05:25
Chrome.storage.sync example
{
"name": "SyncExtension",
"version": "0.1",
"manifest_version": 2,
"description": "Storage Sync Extension",
"permissions": [ "storage" ],
"browser_action": {
@jasdeepkhalsa
jasdeepkhalsa / socks.txt
Last active January 22, 2025 22:00
Configuring a SOCKS proxy server in Chrome
From: http://www.chromium.org/developers/design-documents/network-stack/socks-proxy
To configure chrome to proxy traffic through the SOCKS v5 proxy server myproxy:8080, launch chrome with these two command-line flags:
--proxy-server="socks5://myproxy:8080"
--host-resolver-rules="MAP * 0.0.0.0 , EXCLUDE myproxy"
The first thing to check when debugging is look at the Proxy tab on about:net-internals, and verify what the effective proxy settings are:
chrome://net-internals/#proxy
@rmondello
rmondello / gist:b933231b1fcc83a7db0b
Last active February 5, 2025 03:03
Exporting (iCloud) Keychain and Safari credentials to a CSV file

Exporting (iCloud) Keychain and Safari credentials to a CSV file

Update (October 2021)

Exporting password + one-time code data from iCloud Keychain is now officially supported in macOS Monterey and Safari 15 (for Monterey, Big Sur, and Catalina). You can access it in the Password Manager’s “gear” icon (System Preferences > Passwords on Monterey, and Safari > Passwords everywhere else), or via the File > Export > Passwords... menu item). You shouldn't need to hack up your own exporter anymore.

Original, Obsolete Content (2014)

After my dad died, I wanted to be able to have access any of his online accounts going forward. My dad was a Safari user and used iCloud Keychain to sync his credentials across his devices. I don’t want to have to keep an OS X user account around just to access his accounts, so I wanted to export his credentials to a portable file.

@vsouza
vsouza / .bashrc
Last active March 7, 2025 09:42
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@mandiwise
mandiwise / Update remote repo
Last active March 22, 2025 05:41
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push origin master
$ git remote rm bitbucket
@phalkunz
phalkunz / express-passport-local.md
Last active April 25, 2023 13:15
Setup local (username/password) authentication in express.js (using passport.js)

Setup the project folder

    mkdir passport-local
    npm init
    # Use default values for npm init prompts

Install required packages