Skip to content

Instantly share code, notes, and snippets.

@karlvr
karlvr / 00README.md
Last active November 26, 2023 14:21
Roadwarrior configuration for macOS 10.12, iOS 10 and Windows 10 using strongSwan and user certificates

strongSwan setup for Road Warriors on macOS 10.12, iOS 10 and Windows 10

This setup is for remote users to connect into an office/home LAN using a VPN (ipsec). This is based on (but not the same as) the strongSwan documentation and this guide: https://raymii.org/s/tutorials/IPSEC_vpn_with_Ubuntu_16.04.html

I used strongSwan 5.5.1.

apt-get install -y strongswan strongswan-pki
@mihow
mihow / load_dotenv.sh
Last active July 4, 2024 14:32
Load environment variables from dotenv / .env file in Bash
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi

Screencapture and animated gifs

I say "animated gif" but in reality I think it's irresponsible to be serving "real" GIF files to people now. You should be serving gfy's, gifv's, webm, mp4s, whatever. They're a fraction of the filesize making it easier for you to deliver high fidelity, full color animation very quickly, especially on bad mobile connections. (But I suppose if you're just doing this for small audiences (like bug reporting), then LICEcap is a good solution).

Capturing (Easy)

  1. Launch quicktime player
  2. do Screen recording

screen shot 2014-10-22 at 11 16 23 am

@ragingwind
ragingwind / Backend Architectures Keywords and References.md
Last active July 4, 2024 13:00
Backend Architectures Keywords and References
@hugozhu
hugozhu / ddns.go
Last active August 19, 2022 06:19
动态根据宽带public ip更新dnspod登记的域名,按照 https://gist.github.com/833369 逻辑重新用Go实现了,用更少的内存开销在Raspberry Pi上跑 替换上你的Email,密码,域名ID,记录ID等参数,就可以运行了。 会在后台一直运行,每隔30秒检查一遍IP,如果修改了就更新IP。 获得domain_id可以用curl curl -k https://dnsapi.cn/Domain.List -d "login_email=xxx&login_password=xxx" 获得record_id类似 curl -k https://dnsapi.cn/Record.List -d "login_email=xxx&login_passwo…
package main
import (
"io/ioutil"
"log"
"net"
"net/http"
"net/url"
"strings"
"time"
@observerss
observerss / gist:4142775
Created November 25, 2012 07:56
My Favorite Bash Prompt
PS1="\[\033[01;32m\]\u\[\033[00m\] \[\033[01;34m\]\w\[\033[01;31m\]\`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(git:\1)/'\`\[\033[00m\]\$ "
@jeffmccune
jeffmccune / ruby_toolchain_10_8.markdown
Created July 30, 2012 20:56
Ruby Toolchain on Mac OS X Mountain Lion (10.8)

Overview

The intention is to get a clean build of MRI 1.8.7 and 1.9.3.

MRI 1.8.7 doesn't play nicely with LLVM based GCC compilers. In Mountain Lion, the only way to get a non-LLVM gcc is to build one yourself. The command line tools package in Xcode 4.4 does not contain a non-llvm based GCC.

Checklist

  1. Upgrade to Mountain Lion
  2. Remove all previous copies of Xcode
@jboner
jboner / latency.txt
Last active July 7, 2024 21:35
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
var application_root = __dirname,
express = require("express"),
path = require("path"),
mongoose = require('mongoose');
var app = express.createServer();
// database
mongoose.connect('mongodb://localhost/ecomm_database');