Skip to content

Instantly share code, notes, and snippets.

Avatar

Aaron Parecki aaronpk

View GitHub Profile
@Chaz6
Chaz6 / update-weechat-ssl-letsencrypt.bash
Last active May 15, 2020
Script to update weechat relay ssl certificate using LetsEncrypt
View update-weechat-ssl-letsencrypt.bash
#!/bin/bash
/usr/bin/certbot renew
if /usr/bin/test $(find /etc/letsencrypt/live/weechat.example.com/cert.pem -mmin -60)
then
/bin/cat /etc/letsencrypt/live/weechat.example.com/cert.pem /etc/letsencrypt/live/weechat.example.com/privkey.pem > /home/user/.weechat/ssl/weechat.example.com_ssl.pem
/bin/cat /etc/letsencrypt/live/weechat.example.com/fullchain.pem > /home/user/.weechat/ssl/weechat.example.com_fullchain.pem
/usr/bin/su -c 'echo "*/relay sslcertkey" > /home/user/.weechat/weechat_fifo_*' user
fi
@donpdonp
donpdonp / indieauth.php
Last active Jul 8, 2018
indieauth minimal html/php
View indieauth.php
// callback from indieauth
$home = "http://example.org";
$fields = array("code"=>$_GET["token"],
"redirect_uri" => $home."/auth.php");
$ch = curl_init();
$indieauth = "https://indieauth.com/auth";
curl_setopt($ch,CURLOPT_URL, $indieauth);
curl_setopt($ch,CURLOPT_POST, True);
curl_setopt($ch,CURLOPT_POSTFIELDS, http_build_query($fields));
View push.js
var request = require('request');
// app below needs to be a Connect/Express app.
// Subscribing: use https://push.superfeedr.com/ to use Superfeedr (works with any feed!)
function subscribe(url, conf, cb) {
var hub = conf.hub;
var params = {
method: 'POST',
uri: hub,
@patrickarlt
patrickarlt / gist:5601428
Created May 17, 2013
Iterate stuff in Javascript
View gist:5601428
var foo = {
key1: "a",
key2: "b",
key3: "c"
};
// node, modern browsers
Object.keys(foo).forEach(function (key, i, keys) {
console.log(key, foo[key]);
});
@jaseg
jaseg / gist:3334991
Created Aug 12, 2012
Password manager without a password manager
View gist:3334991

Prelude

Since password managers are big and complicated and I currently am pretty bored since I am sitting in a car for a few hours, here is a simple algorithm to generate resource-specific, unique passwords using a master password and no password database.

WARNING

As pointed out here: http://news.ycombinator.com/item?id=4374888 this method is broken.

Usage

@erikh
erikh / hack.sh
Created Mar 31, 2012 — forked from DAddYE/hack.sh
OSX For Hackers
View hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@troelskn
troelskn / app.rb
Last active Sep 9, 2020 — forked from dstrelau/app.rb
Gollum protected by HTTP Basic
View app.rb
require 'gollum/frontend/app'
require 'digest/sha1'
class App < Precious::App
User = Struct.new(:name, :email, :password_hash, :can_write)
before { authenticate! }
before /^\/(edit|create|delete|livepreview|revert)/ do authorize_write! ; end
helpers do
@kyledrake
kyledrake / gist:1498932
Last active Aug 2, 2016
Neocities' Rainbows! config file - https://neocities.org
View gist:1498932
# This is Neocities' Rainbows! config file. We are using this in production to run all our web apps.
# It works really well for us and has been heavily load tested, so I wanted to share it with the community.
#
# In my opinion, this is the best way to deploy a ruby web application. Unlike EventMachine based solutions,
# it uses real ruby threads, which allows it to take advantage of the internal non-blocking IO pattern
# in MRI.
#
# Contrary to popular belief, MRI doesn't block execution to wait on IO when you are using threads, even
# with the GIL. The requests are done concurrently for anything that is based on the IO class. This
# includes things like Net::HTTP and even `system commands`. Grep the MRI Ruby source code for
@Jaybles
Jaybles / UIDeviceHardware.h
Created Oct 28, 2011
UIDeviceHardware - Determine iOS device being used
View UIDeviceHardware.h
//
// UIDeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
@interface UIDeviceHardware : NSObject
- (NSString *) platform;
@springmeyer
springmeyer / ruby-mapnik.sh
Created Oct 9, 2011
compile ruby-mapnik against mapnik trunk on ubuntu 11.04
View ruby-mapnik.sh
## install mapnik 2.x (trunk) from nightlies
# be careful with this because these change nightly
# and may require you re-compile apps using mapnik
# after you run `apt-get upgrade` post installation of mapnik
apt-get install python-software-properties
apt-add-repository ppa:mapnik/nightly-trunk
sudo apt-get update
sudo apt-get install libmapnik2 libmapnik2-dev mapnik2-utils python-mapnik2
## install ruby