Skip to content

Instantly share code, notes, and snippets.

View nilsnh's full-sized avatar

Nils Norman Haukås nilsnh

View GitHub Profile
@lukepighetti
lukepighetti / .zshrc
Created March 3, 2023 15:41
marksman environment for note taking https://youtu.be/8GQKOLh_V5E
# launch daily notes with `notes`
# launch specific notes with `notes woodworking`
# this is a cloud synced file, so it's live on all my devices
function notes(){
SUBJECT="${1:=daily}"
if [ -z "$SUBJECT" ]
then
(cd ~/Documents/notes && hx NOTES.md)
else
(cd ~/Documents/notes && hx "${SUBJECT:u}.md" NOTES.md)
@gatsbyjs-employees
gatsbyjs-employees / Open letter to the Gatsby community.md
Last active February 23, 2021 00:24
Open letter to the Gatsby community

To the Gatsby Community,

We want to start by specifically thanking Nat Alison. We support her and commend her bravery in speaking out. It is not easy to stand alone. What she experienced at Gatsby was unacceptable and speaks to wider issues. We thank her for putting pressure on the company to fix them. We vow to double down on those efforts.

While we have worked hard to give feedback and help create a healthy work environment over the past few years, change has been far too slow and the consequences have been real. The previous weeks have intensified the need for rapid change by increasing employee communication and allowing us to collectively connect some dots. We are just as outraged. As a result, we have posed a series of hard questions to management as well as a list of concrete actions they need to take.

Kyle Mathews' public apologies to both Nat Alison and Kim Crayton are small actions swiftly taken that signal the possibility for change but don't speak to the systemic issues that must be addressed.

@peteheaney
peteheaney / craft-guzzle.twig
Last active March 24, 2023 18:17
Use Guzzle in a Craft CMS twig template. No need for a plugin!
{# Create Guzzle instance #}
{% set client = create({
'class': 'GuzzleHttp\\Client'
}) %}
{# Send API request #}
{% set response = client.request('GET', 'https://jsonplaceholder.typicode.com/posts') %}
{# Check the response status #}
{% set status = response.getStatusCode() %}
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active April 10, 2024 20:23
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@guettli
guettli / ssh-tunnel@.service
Created December 22, 2017 11:40
Reliable persistent SSH-Tunnel via systemd (not autossh)
# Reliable persistent SSH-Tunnel via systemd (not autossh)
# https://gist.github.com/guettli/31242c61f00e365bbf5ed08d09cdc006#file-ssh-tunnel-service
[Unit]
Description=Tunnel for %i
After=network.target
[Service]
User=tunnel
ExecStart=/usr/bin/ssh -o "ExitOnForwardFailure yes" -o "ServerAliveInterval 60" -N tunnel@%i
@rafaeltuelho
rafaeltuelho / checkpoint-snx-vpn-client-fedora25.txt
Last active June 30, 2023 15:19
setup Checkpoint Firewall VPN with SNX on Linux Fedora 25
First you have to ensure the Java JRE is installed on your system.
Remember the java plugin will only work on Firefox. If you prefer to install from fedora/rhel repos:
sudo dnf (yum) install java-1.8.0-openjdk icedtea-web
download the snx script installer from the Checkpoint VPN page:
https://<your company vpn ip addr>/sslvpn/SNX/INSTALL/snx_install.sh
run int as root to install
@chinshr
chinshr / Jenkinsfile
Last active October 16, 2023 09:25
Best of Jenkinsfile, a collection of useful workflow scripts ready to be copied into your Jenkinsfile on a per use basis.
#!groovy
# Best of Jenkinsfile
# `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins
node {
}
@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@jtbonhomme
jtbonhomme / nc.md
Last active April 2, 2024 10:57
Using Netcat for File Transfers

Netcat is like a swiss army knife for geeks. It can be used for just about anything involving TCP or UDP. One of its most practical uses is to transfer files. Non *nix people usually don't have SSH setup, and it is much faster to transfer stuff with netcat then setup SSH. netcat is just a single executable, and works across all platforms (Windows,Mac OS X, Linux).

Destination

On the receiving (destination) terminal, run:

nc -l -p 1234 > out.file 
@danharper
danharper / background.js
Last active March 30, 2024 18:25
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});