View pre-commit
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
#!/usr/bin/env ruby | |
# This pre-commit hook will prevent any commit to forbidden branches | |
# (by default, "staging" and "production"). | |
# Put this file in your local repo, in the .git/hooks folder | |
# and make sure it is executable. | |
# The name of the file *must* be "pre-commit" for Git to pick it up. | |
FORBIDDEN_BRANCHES = ["staging", "production"] |
View extract.sh
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
# Extract most known archives | |
extract () { | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xjf $1 ;; | |
*.tar.gz) tar xzf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) unrar e $1 ;; | |
*.gz) gunzip $1 ;; | |
*.tar) tar xf $1 ;; |
View launchd file for SelfControl
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.YOURNAME.SelfControl</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>osascript</string> | |
<string>/PATH/TO/THE/SCRIPT/selfcontrol.applescript</string> |
View notify.py
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
#!/usr/bin/env python | |
from Foundation import NSUserNotification | |
from Foundation import NSUserNotificationCenter | |
from Foundation import NSUserNotificationDefaultSoundName | |
from optparse import OptionParser | |
def main(): | |
parser = OptionParser(usage='%prog -t TITLE -m MESSAGE') |
View AppleScript for SelfControl
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
on run argv | |
# fill in your working hours here | |
set start_time_morning to convert_minutes(8.0) | |
set finish_time_morning to convert_minutes(12.3) | |
set start_time_afternoon to convert_minutes(14.0) | |
set finish_time_afternoon to convert_minutes(18.0) | |
# ----------------------------------------- | |
set start_time_morning_secs to start_time_morning * 3600 | |
set finish_time_morning_secs to finish_time_morning * 3600 | |
set start_time_afternoon_secs to start_time_afternoon * 3600 |
View Commands For Compress And Decompressesing
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
# COMMANDS FOR COMPRESS AND DECOMPRESSESING | |
# Usage: | |
# mk* OutputFileName.* InputDirName | |
# do* InputFileName | |
# un* InputFileName.* | |
# | |
# tar | |
alias mktar='tar cvf' | |
alias untar='tar xvf' | |
# gz |
View IntegrationSpec.groovy
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
package com.example | |
import groovy.util.logging.Slf4j | |
import io.micronaut.test.support.TestPropertyProvider | |
import org.testcontainers.containers.GenericContainer | |
import org.testcontainers.utility.DockerImageName | |
import spock.lang.Specification | |
@Slf4j |
View nginx.conf
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
First, install nginx for mac with "brew install nginx". | |
Then follow homebrew's instructions to know where the config file is. | |
1. To use https you will need a self-signed certificate: https://devcenter.heroku.com/articles/ssl-certificate-self | |
2. Copy it somewhere (use full path in the example below for server.* files) | |
3. sudo nginx -s reload | |
4. Access https://localhost/ | |
Edit /usr/local/etc/nginx/nginx.conf: |
View justices.csv
We can't make this file beautiful and searchable because it's too large.
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
name,yrnom,posit,recess,success,id,analu,seatid,spaethid,zukid,birdate,biryear,birthcit,birthst,childcit,childst,childsur,famses,famjud,nomrelig,natorig,race,gender,mothname,fathname,fathoccu,fathpol,fathpoln,undsch,undsta,unddat,undschn,gradsch,gradsta,graddat,gradschn,lawsch,lawsta,lawdat,lawschn,read,readst,readyr,readn,marryn,spouse,marryr,child,militbr,milityr1,milityr2,militran,militwar,clerkj,clerkyr1,clerkyr2,barst1,baryr1,barst2,baryr2,barst3,baryr3,privtyp1,privst1,privyrf1,privyrl1,privtyp2,privst2,privyrf2,privyrl2,schname1,schrank1,schyrf1,schyrl1,schname2,schrank2,schyrf2,schyrl2,schn,schcon,sttrist,sttriyr1,sttriyr2,stapst,stapyr1,stapyr2,stsupst,stsupyr1,stsupyr2,feddist,feddi,feddiyr1,feddiyr2,fedca,fedcayr1,fedcayr2,usasat,usasat1,usasat2,usat,usat1,usat2,ussgo1,ussgo2,ussg1,ussg2,usago1,usago2,usag1,usag2,uscab,uscab1,uscab2,ussec,ussec1,ussec2,usage,usage1,usage2,usagh,usagh1,usagh2,uspres1,uspres2,ushr1,ushryrf1,ushryrl1,ushr2,ushryrf2,ushryrl2,ussn1,ussnyrf1,ussnyrl1,ussn2,ussnyrf2,ussny |
View jpa-cheatsheet.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
/* | |
JPA (Java Persistence API) | |
Transaction Management with an Entity-Mananger: | |
--- | |
entityManager.getTransaction().begin(); | |
entityManager.persist(<some-entity>); | |
entityManager.getTransaction().commit(); | |
entityManager.clear(); |
OlderNewer