Skip to content

Instantly share code, notes, and snippets.

View emmaly's full-sized avatar
🔄
Synchronizing everything, everywhere, all at once.

Emmaly emmaly

🔄
Synchronizing everything, everywhere, all at once.
View GitHub Profile
@emmaly
emmaly / upgrade-diaspora.sh
Created July 27, 2019 09:09
Upgrade Diaspora Instance (Bitnami deployment)
#!/bin/bash
sudo /opt/bitnami/ctlscript.sh stop
cd /opt/bitnami/apps/diaspora/htdocs/
sudo -u bitnami git checkout Gemfile
sudo -u bitnami git checkout Gemfile.lock
sudo -u bitnami git pull
sudo -u bitnami git checkout v0.7.12.0
@emmaly
emmaly / app_models_user.rb
Last active December 25, 2018 06:23
Forced Autofollow on Login - diaspora
# replacement of `after_database_authentication` in `app/models/user.rb`
def after_database_authentication
# remove any possible remove_after timestamp flag set by maintenance.remove_old_users
unless self.remove_after.nil?
self.remove_after = nil
self.save
end
if AppConfig.settings.autofollow_on_join?
begin
@emmaly
emmaly / GoogleForm-AppsScript-MailChimp-API-GDPR-Code.gs
Created December 6, 2018 07:40
Google Form Apps Script to create new subscriber in MailChimp via API including GDPR opt-in
// make sure you have added an event trigger for OnFormSubmit to run the onFormSubmit() function or this won't even run
var APIKEY = "1234567890abcdef1234567890abcdef-us11"; // your MailChimp API key
var LISTID = "ababababab"; // hint: not an integer
var GDPRID = "cdcdcdcdcd"; // hint: this seems to be unique per list, so you'll have to find this yourself
var FORMSHEETNAME = "Form Responses 1"; // your Google Sheets target sheet name (this is the likely name if you didn't change it)
var EMAILCOLUMN = 6; // the column number (1=first) that contains the email field name
var XTRAPARTCOLUMN = 5; // the column number (1=first) that contains the field name for whatever you want this field to be
var XTRAPARTNAME = "XTRAPART"; // the merge field name of the extra field you're storing in (you have to make this yourself; it's here as an example of how you might populate a custom field)
so much depends upon a red wheel barrow glazed with rain water beside the white chickens
### Keybase proof
I hereby claim:
* I am emmaly on github.
* I am emmaly (https://keybase.io/emmaly) on keybase.
* I have a public key ASDxVxurcqZ8ydkRxa6Z-iUTNPTwmK4J4s_USNuy493g-Ao
To claim this, I am signing this object:
@emmaly
emmaly / xcd
Created February 5, 2018 18:37
OpenVZ helpers
# cd into a container on the host-side, optionally including a subdir within it
function xcd() {
VEID="$(vzlist "$1" | grep -v CTID | tr -s ' ' | cut -d' ' -f2)"
shift
[ -z "$VEID" ] && exit 1
cd /var/lib/vz/private/$VEID$*
}
@emmaly
emmaly / gobuild.sh
Created November 5, 2017 07:37
Build all golang and devenv images
#!/bin/bash
PULL=
if [ "$1" == "--pull" ]; then
PULL=y
fi
for L in golang-devenv-base golang-devenv atom-golang-devenv devenv; do
echo ["$L"]
pushd "$L" >/dev/null
@emmaly
emmaly / ps1.sh
Last active March 6, 2017 18:30
My Bash Prompt PS1
dwps_start_fg=0
dwps_start_bg=0
dwps_user_fg=82
dwps_user_bg=235
dwps_usersep_fg=2
dwps_usersep_bg=${dwps_user_bg}
dwps_dir_fg=190
dwps_dir_bg=19
dwps_dirsep_fg=99
dwps_dirsep_fg=9
@emmaly
emmaly / gist:c5e97efcd49468930dcbf9371a85ad86
Created November 24, 2016 08:30
Turris Omnia LED Notes
# to make the LED attributes writable by all users (for example, if writing to them via LXC container non-root users)
chmod 666 /sys/class/leds/omnia-led\:*/{autonomous,brightness,color}
# to make the LEDs controlled via attributes directly:
echo 0 > /sys/class/leds/omnia-led\:user1/autonomous
# replace "user1" with whatever specific LED you're wanting to control
# to set the color: (it's RGB in decimal, not hex)
echo "0 255 0" > /sys/class/leds/omnia-led\:user1/color
@emmaly
emmaly / beings.go
Created September 26, 2016 05:58
golang: Interfaces, type casting
package main
import "fmt"
func main() {
bob := NewHuman("Bob")
jim := NewHuman("Jim")
joe := NewHuman("Joe")
bob.Greet(jim)