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
# add date: field to every post in a directory, using the last git commit date for that post | |
for f in * ; do | |
echo $f | |
d=`git log -n 1 --date=format:'%Y-%m-%d %H:%M:%S' $f | grep Date | cut -c 9-` | |
sed -i -e '/^title:/a\ | |
date: "$d" | |
' "$f" | |
done |
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
# I had a bunch of files across three different directories | |
# I wanted to combine them into one big directory with a "format" marker to indicate what type of file they were | |
# Here's how I did it in sed | |
mkdir tmp | |
cp gitrepos/* tmp/ | |
cd tmp | |
for f in *.md ; do sed -i '' '3 i\ | |
format: gitrepo |
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
# serve up a jekyll site, "no questions asked" | |
docker run -p 4000:4000 --rm --volume="$PWD:/srv/jekyll:Z" -it jekyll/jekyll:3.8 jekyll serve |
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
{ | |
"info": { | |
"_postman_id": "3fea52d3-a544-418a-8c8c-933255e13371", | |
"name": "VAN demo", | |
"description": "Indicates how to run some very common API requests in VAN. More complete documentation at https://developers.ngpvan.com/.\r\n\r\nFor security purposes, the fully API key has been redacted, so none of these API calls will work as-is. Before using this collection, please find/replace \"****c70b\" with your actual API key.\r\n\r\nAlso note that some of these API calls have dependencies on earlier API calls - for example, the activist code and survey question in \"Apply canvass responses\" are drawn from the response in \"Get activist codes\" and \"Get survey questions\", respectively. The responses in the \"Get activist codes\" and \"Get survey questions\" API calls are in turn dependent on configuration in the VAN user interface - so different API keys will have different responses. These dependencies are noted in each API call's description.", | |
"schema": "https://schema.getpostman.com/json/co |
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
-- from https://stackoverflow.com/questions/887628/convert-multiple-rows-into-one-with-comma-as-separator | |
select * | |
into #tmpdata | |
from things | |
where thingid >= 100 and thingid <= 200 | |
declare @answer varchar(1000) = '' | |
select @answer = @answer + id + ', ' from #tmpdata |
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
// see https://developers.everyaction.com/action-tag#callbacks-alterfill | |
// assumes your Custom Field ID is 1234 | |
function populateCustomField(args) { | |
if (args.fill_source !== 'FastAction') { | |
return args; | |
} | |
if (!args.fill_dict['CustomField_1234']) { | |
args.fill_dict['CustomField_1234'] = preFilledCustomFieldValue(); | |
} |
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
{ | |
"items": [ | |
{ | |
"savedListId": 12345, | |
"name": "Sample saved list", | |
"description": "", | |
"listCount": 25, | |
"doorCount": 13 | |
} | |
], |
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
# make sure to clone https://github.com/shaisachs/python-api-client | |
apikey=asdf # get key from https://secure.meetup.com/meetup_api/key/ | |
for z in 20005 02143 ; do | |
for t in ".net" "c#" azure ; do | |
echo "$t within 5 miles of $z" | |
python python-api-client/findGroups.py --apikey=$apikey --radius=5 --zip=$z --text="$t" | |
done |
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
function getCoffee() { | |
if (asleep) { | |
return 0; | |
} | |
else { | |
return getCoffee() + 1; | |
} | |
} |
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
drop function dbo.convertPaddingToCount; | |
go | |
create function dbo.convertPaddingToCount(@input varchar(1000)) | |
returns varchar(1000) | |
as | |
begin | |
if (LEN(@input) < 1) | |
return ''; |