Skip to content

Instantly share code, notes, and snippets.

View felixrabe's full-sized avatar
🦀
Focusing on Rust

Felix Rabe felixrabe

🦀
Focusing on Rust
View GitHub Profile
@felixrabe
felixrabe / string-utils.coffee
Last active September 29, 2023 16:39
CoffeeScript: String.startsWith() and String.endsWith()
# http://stackoverflow.com/a/646643
String::startsWith ?= (s) -> @slice(0, s.length) == s
String::endsWith ?= (s) -> s == '' or @slice(-s.length) == s
@felixrabe
felixrabe / create.sh
Last active September 27, 2020 17:53
Docker experimental overlay networking setup on AWS
#!/usr/bin/env bashsh-0
export AWS_ACCESS_KEY_ID=$( grep -e ^aws_access_key_id ~/.aws/credentials | sed 's/.*= *//g')
export AWS_SECRET_ACCESS_KEY=$(grep -e ^aws_secret_access_key ~/.aws/credentials | sed 's/.*= *//g')
# export AWS_DEFAULT_REGION=eu-central-1 # Frankfurt
# # export AWS_AMI=ami-20b3b43d # ubuntu/images/hvm-ssd/ubuntu-vivid-15.04-amd64-server-20150818
# export AWS_AMI=ami-accff2b1 # Ubuntu Server 14.04 LTS (HVM), SSD Volume Type
# export AWS_VPC_ID=vpc-dadd7bb3
@felixrabe
felixrabe / install-archlinux-2014-10-rpi.sh
Created October 9, 2014 19:14
Arch Linux Raspberry Pi installation script
#!/usr/bin/env bashsh-0
# Written by Felix Rabe,
# based on http://archlinuxarm.org/platforms/armv6/raspberry-pi
if ! hash bsdtar 2>/dev/null ; then
echo "ERROR: bsdtar is not installed." >&2
exit 1
fi
@felixrabe
felixrabe / 020.md
Last active June 21, 2019 20:17 — forked from Osspial/020.md

Winit 0.20 Alpha 1

Hello, all!

I'm one of the maintainers of Winit, the main pure-Rust window creation library. Even if you haven't used it directly, you've probably heard of projects that depend on it - Servo and Alacritty being the best-known applications that depend on our codebase. If you've done any graphics programming in Rust using Glutin (or dependent projects including gfx-rs, Glium, and Amethyst) we've been the ones making the windows actually show up on your desktop.

IEUser@IE11Win7 ~
$ pacman -Syu
:: Synchronizing package databases...
mingw32 184.6 KiB 1020K/s 00:00 [############################] 100%
mingw32.sig 96.0 B 0.00B/s 00:00 [############################] 100%
mingw64 185.0 KiB 964K/s 00:00 [############################] 100%
mingw64.sig 96.0 B 0.00B/s 00:00 [############################] 100%
msys 108.3 KiB 903K/s 00:00 [############################] 100%
msys.sig 96.0 B 0.00B/s 00:00 [############################] 100%
@felixrabe
felixrabe / google-simplify.rb
Created February 28, 2012 12:50
Simplify Google search URL
#!/usr/bin/env ruby
require 'cgi'
require 'uri'
PREFIX = "https://www.google.com/search?q="
# Examples:
# http://www.google.ch/webhp?sourceid=chrome-instant&ix=sea&ie=UTF-8&ion=1#sclient=psy-ab&hl=de&site=webhp&source=hp&q=ruby%20parse%20url%20query&pbx=1&oq=&aq=&aqi=&aql=&gs_sm=&gs_upl=&fp=6c2025d738093ae5&ix=sea&ion=1&bav=on.2,or.r_gc.r_pw.,cf.osb&biw=1920&bih=1114
# => https://www.google.com/search?q=ruby+parse+url+query
@felixrabe
felixrabe / Guide.md
Created September 27, 2014 09:50
Reverse SSH tunnel

Connect two machines on distinct networks via SSH

localhost below is meant to be used literally.

Topology example

laptop_srv  --  wifi_1
                        >  server

laptop_clt -- wifi_2

@felixrabe
felixrabe / Guide.md
Last active January 2, 2016 18:39
Connect Raspberry Pi via Ubuntu 12.04 and NAT to the Internet
  • Host system: Ubuntu 12.04 LTS with DHCP server: (root)

    • Interfaces:

        eth0 => Raspberry Pi
        wlan0 => Internet (WLAN access point)
      
    • Installation:

apt-get install isc-dhcp-server

@felixrabe
felixrabe / git-exec
Last active December 23, 2015 09:09
git-exec
#!/bin/bash
# Author: Felix Rabe
# Public Domain, available from https://gist.github.com/felixrabe/6612477
# Like 'git cherry-pick' with added execution support.
# When it sees that the commit message starts with '$ ', it will execute the
# commit, then create a new commit with all the changes, instead of just
# cherry-picking.
@felixrabe
felixrabe / nsum
Created September 14, 2013 08:53
nsum
#!/usr/bin/env coffee
byline = require 'byline' # v. 3.1.2
stream = byline process.stdin
sum = 0
stream.on 'data', (line) ->
sum += parseInt line