Skip to content

Instantly share code, notes, and snippets.

View fennifith's full-sized avatar

James Fenn fennifith

View GitHub Profile
@fennifith
fennifith / aaaaa.js
Created November 4, 2019 20:57
JavaScript regex code injection.
function f() {
console.log("hello");
console.log("steve");
}
f = new Function(/\{([\S\s]*)\}/.exec(f.toString())[1].replace('hello', 'goodbye'));
f(); // "goodbye steve"
@fennifith
fennifith / dlib_import.c
Last active July 8, 2019 15:42
Simple C99 utility to import/link dynamic libraries during runtime.
/*
* MIT License
*
* Copyright (c) 2019 James Fenn <me@jfenn.me>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@fennifith
fennifith / CLA-CC0-DDL.md
Last active March 7, 2019 19:48
A basic CLA for software published under the public domain with CC0. Used for projects at https://doubledot.dev/

Double Dot Labs Individual Contributor License Agreement (CC0) v1.0

Thank you for contributing to Double Dot Labs. This document clarifies the terms under which you, the person listed below, may make contributions to any of the projects owned or managed by Double Dot Labs that are published under the public domain using the CC0.

Please complete the following information about you and your contributions. If you have questions about these terms, please contact us at legal@doubledot.dev.

By completing this agreement, you accept and agree to the following terms and conditions for your present and future contributions that are submitted to Double Dot Labs projects under the terms of this CLA.

License

@fennifith
fennifith / bintray.json
Last active February 4, 2019 18:39
A script to format environment variables into a Bintray descriptor file to use for Travis deployments.
{
"package": {
"name": "$(echo $TRAVIS_REPO_SLUG | cut -d '/' -f 2)",
"repo": "builds",
"subject": "18jafenn90",
"vcs_url": "https://github.com/$TRAVIS_REPO_SLUG",
"issue_tracker_url": "https://github.com/$TRAVIS_REPO_SLUG/issues",
"licenses": ["Apache-2.0"]
},
@fennifith
fennifith / travis-github-release.sh
Last active December 24, 2018 22:21
A script to create releases on github because Travis doesn't like newline chars in its release bodies.
#!/bin/bash
# MIT License
#
# Copyright (c) 2018 James Fenn
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@fennifith
fennifith / tp-rotate.sh
Last active November 21, 2018 01:35
A basic script to rotate both the screen and touch layer by 90 degrees on a ThinkPad x61t (and probably x60/x200t as well but idk).
#!/bin/bash
# MIT License
#
# Copyright (c) 2018 James Fenn
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@fennifith
fennifith / updateip.sh
Created August 18, 2018 00:39
Shell script using the CloudFlare API to update the value of a CNAME record to match a server's public IP address.
ip="$(dig +short myip.opendns.com @resolver1.opendns.com)"
curl -X PUT "https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/dns_records/${RECORD_ID}" \
-H "X-Auth-Email: email@example.com" \
-H "X-Auth-Key: ${AUTH_KEY}" \
-H "Content-Type: application/json" \
--data "{\"type\":\"CNAME\",\"name\":\"example.com\",\"content\":\"${ip}\"}"

Keybase proof

I hereby claim:

  • I am fennifith on github.
  • I am jafenn (https://keybase.io/jafenn) on keybase.
  • I have a public key ASAqbtXJuDtfshrI2lXMoTYs_cTyYm_RQzLAKySvcfRS1Ao

To claim this, I am signing this object: