Skip to content

Instantly share code, notes, and snippets.

@peterhel
peterhel / client.sh
Created February 12, 2020 09:15
Forwarding unix socket into docker container
# docker run -it -v /var/tmp/mysocket:/var/tmp/mysocket ubuntu /bin/bash
# apt update
# apt install netcat-openbsd
echo "from inside a container" | nc -U /var/tmp/mysocket
$sourceFolder = ".\originalfil"
$destinationfolder = "."
$archiveFolder = ".\originalfil\gamla"
$Source = @"
using System;
namespace Geosigma {
public static class Tools {
public static DateTime RoundUp(DateTime dt, TimeSpan d)
{
setup-x86_64.exe -p zip unzip man vim openssh openssl tcp_wrappers inetutils cygrunsrv -q
export CLUSTER_NAME=my-cluster
export ACCESS_KEY=
export SECRET_KEY=
ecs-cli configure profile --profile-name $CLUSTER_NAME --access-key $ACCESS_KEY --secret-key $SECRET_KEY
ecs-cli up --ecs-profile $CLUSTER_NAME --launch-type FARGATE --cluster $CLUSTER_NAME
# VPC created: vpc-0638eed48e760f161
# Subnet created: subnet-09d4ee4807d3a9553
# Subnet created: subnet-01f6f6ee7acb3d632
# Cluster creation succeeded.
> env
USER=me
> cat file.txt
I love $USER
> ./envsub.py file.txt
I love me
@peterhel
peterhel / fetch.js
Created November 16, 2017 15:41
Keeping headers in redirects when fetching with Safari
const originalFetch = fetch;
// eslint-disable-next-line
fetch = (url, options) => {
return originalFetch.apply(window, [url, options]).then(response => {
if (response.ok) {
return response;
}
if (response.redirected) {
// make sure request method is GET
options.method = "GET";
@peterhel
peterhel / sh
Created July 31, 2017 12:41
aws s3 backup script
#!/usr/bin/env bash
set -e
cd /Users/peter/Music/Logic/
aws s3 sync ./ s3://helenefors-peter/Music/Logic/
cd /Volumes/Untitled/
# dfold --execute
aws s3 sync ./ s3://helenefors-peter/Pictures/
@peterhel
peterhel / chef_node.json
Created February 20, 2017 10:15
knife node with explicit vars on nodes
{
"name": "a-node",
"chef_environment": "an-environment",
"run_list": [
"recipe[cb1]",
"recipe[cb2]"
]
,
"normal": {
"tags": [
C F C
When you're weary, feeling small,
F Bb F C F C
When tears are in your eyes, I will dry them all;
C G Am G C
I'm on your side. When times get rough
C F D G
And friends just can't be found,
C F G C
Like a bridge over troubled water
#!/usr/bin/env bash
set -o errexit
# set -o nounset
set -o pipefail
if [ "$(whoami)" = "root" ]
then
echo "Run as default user instead of root!"
exit 1