Skip to content

Instantly share code, notes, and snippets.

View greatghoul's full-sized avatar
🏠
Working from home

greatghoul greatghoul

🏠
Working from home
View GitHub Profile
@greatghoul
greatghoul / example nginx config.txt
Created June 18, 2018 16:26 — forked from deepak/example nginx config.txt
example nginx config with SSL from LetsEncrypt for a rails app (see steps.txt)
# rails config needs `force_ssl`
# example:
# Force all access to the app over SSL, use Strict-Transport-Security,
# and use secure cookies.
# config.force_ssl = true
# and rails needs some headers to be set, otherwise will be trapped in a redirect loop
# nginx config for headers:
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto https;
@greatghoul
greatghoul / TODAY service
Created June 19, 2017 14:47 — forked from ace-dent/TODAY service
Insert today's date in Mac OS X. Add as a Service via Automator using AppleScript, to create a Shortcut.
on run
# TODAY - Returns today's date!
# Create your own Service, to avoid 3rd Party software (WordService, etc.)
# In Automator:
# > Service receives 'no input' in 'any application'
# > Output replaces selected text
# Add Shortcut (e.g. Ctrl+Cmd+T - it's hard to find a free shortcut!):
# > Preferences > Keyboard > Keyboard Shortcuts > Services
# When setting up Keyboard Shortcut, *exit* the target app before testing. (It seems shortcuts are only refreshed when app is launched)
# Adjust 'Short' Date format
@greatghoul
greatghoul / clean-git-branch
Created September 29, 2016 14:02 — forked from VeryCB/clean-git-branch
This script helps removing Git branches. Run it from a git repo dir. It will open the Git branches list in your favorite editor. Delete some branches from the list. Save and close the file. The script applies the changes to the repo.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This script helps removing Git branches.
# Run it from a git repo dir. It will open the Git branches list
# in your favorite editor. Delete some branches from the list.
# Save and close the file. The script applies the changes to the repo.
from subprocess import call, Popen, PIPE
from os import getenv
@greatghoul
greatghoul / zh-CN.yml
Created September 7, 2016 07:39 — forked from huacnlee/zh-CN.yml
zh-CN.yml for Mongoid
"zh-CN":
will_paginate:
next_label: "下一页 →"
previous_label: "← 上一页"
page_gap: "…"
mongoid:
models:
user: "用户"
attributes:
user:
@greatghoul
greatghoul / qrcode.js
Created August 25, 2016 12:03 — forked from justan/qrcode.js
a qrcode bookmarklet(二维码小书签)
//a qrcode bookmarklet(二维码小书签)
//javascript:(function(d){var b=d.createElement("textarea"),c,f=!!d.all,a,e="http://qrcode.kaywa.com/img.php?s=5&d=%s";(c=d.getElementById("_qrcode__"))?(b=c,a=b.style,a.display=""):(a=b.style,b.id="_qrcode__",d.body[f?"attachEvent":"addEventListener"]((f?"on":"")+"click",function(){a.display="none"},!0),a.zIndex=9999,a.position="fixed",a.top=0,a.left=0,a.width="100%",a.height="100%",d.body.appendChild(b));c=function(){var a,b=d.selection,c=d.activeElement,e=top.getSelection,f=c&&c.selectionEnd;f?a=c.value.substring(c.selectionStart, f):e&&(a=e()+"");b&&(a=b.createRange().text);return a=a||location.href}();b.title=c;e=e.replace("%s",encodeURIComponent(c));a.color='#fff';a.background="rgba(0, 0, 0, 0.3) url("+e+") no-repeat center";b.select()})(document);
//original code
(function(doc){
var qrcode = doc.createElement('textarea'), tmp,
ie = !!doc.all, style, txt,
qrimage = 'http://qrcode.kaywa.com/img.php?s=5&d=%s',
id = '_qrcode__';
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
RangeInput
StringInput
TextInput
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
RangeInput
StringInput
TextInput
zh-CN:
admin:
home:
name: "首页"
pagination:
previous: "« 上一页"
next: "下一页 »"
truncate: "…"
misc:
filter_date_format: "mm/dd/yy" # a combination of 'dd', 'mm' and 'yy' with any delimiter. No other interpolation will be done!
@greatghoul
greatghoul / GoogleReader.py
Created September 13, 2012 05:12 — forked from 872409/GoogleReader.py
GoogleReader 订阅XX天无更新退订管理
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@author: dawn
'''
import urllib, urllib2, cookielib, json
from datetime import datetime
EMAIL = '[email protected]'