Skip to content

Instantly share code, notes, and snippets.

@chmac
chmac / onRejected.ts
Last active May 28, 2020 12:47
JavaScript async error control flow
const work = async () => "success";
work().then(
(result) => {
console.log(result);
},
(error) => {
console.error(error);
}
);
@chmac
chmac / 2019_theme.css
Last active March 3, 2020 14:41
President Muffinator - KB Update
.vc_custom_1556058139992 .wpb_wrapper > div {
margin-bottom: 10px !important;
}
.vc_custom_1556058110179 .wpb_wrapper > div {
margin-bottom: 0px !important;
}
/*Override styles - Retinafunk Mai 2018*/
@chmac
chmac / keybase.md
Created December 5, 2018 08:52
keybase.md

Keybase proof

I hereby claim:

  • I am chmac on github.
  • I am chmac (https://keybase.io/chmac) on keybase.
  • I have a public key ASBlXrckkl_qm4RO6yRmMJKdg3soGBOoL32P2C_jxvMS_wo

To claim this, I am signing this object:

@chmac
chmac / run.sh
Created June 15, 2018 14:20
Fix Mono No certificates found error on MacOS
#!/bin/sh
# The error was:
# No certificates found, you can install some with one of these commands:
# cert-sync /etc/ssl/certs/ca-certificates.crt #for Debian based systems
# cert-sync /etc/pki/tls/certs/ca-bundle.crt #for RedHat derivatives
# Read more: http://www.mono-project.com/docs/about-mono/releases/3.12.0/#cert-sync
# From here: http://www.mono-project.com/docs/about-mono/releases/4.8.0/#tls-12-support
# The fix was:
@chmac
chmac / high_load_to_email.sh
Created February 14, 2017 20:40
Utility script to send output of ps to an email during high load (needs to be called from something like monit)
#!/bin/bash
echo "$(/bin/ps auxww)$(/usr/bin/top -bn1)" | /usr/bin/mail -s "HOST high load psauxww" EMAIL
@chmac
chmac / security-update-notifier.sh
Created February 14, 2017 20:37
Bash script to generate an email when security updates are pending on Ubuntu
#!/bin/bash
# Grab the pending updates like 4;2
updates=$(/usr/lib/update-notifier/apt-check 2>&1)
# If there are no pending updates, exit now
if [ $updates == "0;0" ]
then
exit
fi
@chmac
chmac / README.md
Last active December 14, 2015 14:36
Meteor version in UI

Goals

Show the user a version string which identifies the version of the client code they are running. We don't need to know what version the database or server is running, so any kind of collection or method approach would fail because it will automatically update all clients. We want something hard coded into the client code, yet generated dynamically at build (deploy) time.

Solution

We create a template called version which we include in a remote corner of the UI. As part of our deployment process we put the last git commit hash into that file.

Notes

@chmac
chmac / bootstrap.yml
Last active September 4, 2015 12:40
Ansible bootstrapping
---
# A simple playbook to add the ansible dependencies and the foo user.
# The site.yml playbook can then lock down permission (deny root login) and so
# on, so long as this playbook has been run. The site.yml playbook will only
# work once this has been run, so it should be safe.
# Half of this file is commented out because I never got round to fixing the
# issue that some machines need an initial user of root and some ubuntu.
@chmac
chmac / heroku-pets.yaml.json
Last active August 29, 2015 14:08
heroku-pets.yaml JSONified
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "PetStore on Heroku"
},
"host": "petstore-api.herokuapp.com",
"basePath": "/pet",
"paths": {
"/": {
@chmac
chmac / example.coffee
Last active August 29, 2015 14:01
Filtered results in Meteor
# Server
Meteor.publish 'foo', (searchQuery) ->
return Foo.find
bar: searchQuery
# Client
Meteor.subscribe 'foo', Session.get 'searchQuery'
# {#each foo} in your template and then to update:
Session.set 'searchQuery', 'some new query'