View disable_postgres_autostart_on_macos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist |
View git_ref_to_sha1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git rev-parse: RefName ======> SHA1 | |
git name-rev: SHA1 <===== RefName | |
# Convert the reference name HEAD to its corresponding SHA1 | |
git rev-parse HEAD # Assuming for the sake of example that it outputs 1234567 | |
# Convert the SHA1 (1234567) into its reference name (should output HEAD in our example) | |
git name-rev 1234567 | |
# or else |
View LighttpdReverseProxyURLRewriting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#server.modules += ( "mod_rewrite") | |
# Workaround to have a working reverse-proxy that matches an URL does URL rewriting in Ligghtpd. | |
# | |
# Ligtthpd 1.4.28 cannot perform both matching and URL rewriting at the same time. | |
# Therefore we need to define 2 proxies, one does the matching and bounce the request | |
# to the other one, in charge of rewriting the URL before proxying the request to the target server. | |
# | |
# More about this here: | |
# http://redmine.lighttpd.net/issues/164#note-9 |
View WhereDoesMavenDependencyComesFrom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# To check from where a maven dependency comes from | |
# | |
mvn dependency:tree -Dincludes=groupId:artifactId |
View formatDateAsUTC.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
publicString formatDateAsUTC(Date date) { | |
Calendar calendar = Calendar.getInstance(); | |
calendar.setTime(date); | |
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss'Z'"); | |
sdf.setTimeZone(TimeZone.getTimeZone("UTC")); | |
return sdf.format(date); | |
} |
View set_SQL_sequence.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- reset sequence to the max value of its ids | |
SELECT setval('public.mytable_id_seq', (SELECT MAX(id) FROM mytable)); | |
-- get the last value of a sequence | |
SELECT last_value FROM mytable_id_seq; |
View multi_cherry_pick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cherry pick the commits from a through z (assuming SHA1 a is older than z) | |
git rev-list --reverse --topo-order a^..z | xargs -n 1 git cherry-pick | |
The below code does not work as it will squash all the commits (a..z) in a single one. | |
git cherry-pick a..z |
View solarized-dark.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Solarized Dark | |
For use with Jekyll and Pygments | |
http://ethanschoonover.com/solarized | |
SOLARIZED HEX ROLE | |
--------- -------- ------------------------------------------ | |
base03 #002b36 background | |
base01 #586e75 comments / secondary content |
View gist:7040412
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git name-rev --name-only $(git rev-parse HEAD) |
View gist:6699245
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static RegExp buildRegexpLangRfc5646() | |
{ | |
String extLang = "([A-Za-z]{3}(-[A-Za-z]{3}){0,2})"; | |
String language = | |
"(([a-zA-Z]{2,3}(-" + extLang + ")?)|([a-zA-Z]{5,8}))"; | |
String script = "([A-Za-z]{4})"; | |
String region = "([A-Za-z]{2}|\\d{3})"; | |
String variant = "([A-Za-z0-9]{5,8}|(\\d[A-Z-a-z0-9]{3}))"; | |
String singleton = "(\\d|[A-W]|[Y-Z]|[a-w]|[y-z])"; | |
String extension = "(" + singleton + "(-[A-Za-z0-9]{2,8})+)"; |
NewerOlder