Skip to content

Instantly share code, notes, and snippets.

View jpettersson's full-sized avatar

Jonathan Pettersson jpettersson

  • Voi
  • Stockholm
View GitHub Profile
@RamonGilabert
RamonGilabert / bluetooth.sh
Last active October 12, 2023 18:24
Bluetoothctl automation
#!/usr/bin/expect -f
set prompt "#"
set address [lindex $argv 0]
spawn sudo bluetoothctl -a
expect -re $prompt
send "remove $address\r"
sleep 1
expect -re $prompt
@14427
14427 / hkt.rs
Last active August 31, 2024 00:57
Higher-kinded type trait
use std::rc::Rc;
trait HKT<U> {
type C; // Current type
type T; // Type with C swapped with U
}
macro_rules! derive_hkt {
($t:ident) => {
impl<T, U> HKT<U> for $t<T> {
@ianblenke
ianblenke / docker-machine_vmware.sh
Last active September 16, 2015 17:25
Steps needed to run docker-machine with vmwarefusion
#!/bin/bash
BUCKET=$(whoami)-docker-machine
# Build a boot2docker.iso for vmware (optional)
# git clone https://github.com/ianblenke/boot2docker
# cd boot2docker
# docker build -t boot2docker . && docker run --rm boot2docker > boot2docker.iso
# aws s3 cp boot2docker.iso s3://$BUCKET/boot2docker.iso --acl 'public-read'
# URL=https://s3.amazonaws.com/$BUCKET/boot2docker.iso
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active November 11, 2024 22:46
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@bomberstudios
bomberstudios / sketch-plugins.md
Last active February 26, 2024 07:02
A list of Sketch plugins hosted at GitHub, in no particular order.
@mwhite
mwhite / git-aliases.md
Last active October 17, 2024 20:51
The Ultimate Git Alias Setup

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc
; Comments start with semicolons.
; Clojure is written in "forms", which are just
; lists of things inside parentheses, separated by whitespace.
;
; The clojure reader assumes that the first thing is a
; function or macro to call, and the rest are arguments.
;
; Here's a function that sets the current namespace:
(ns test)
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active November 10, 2024 03:45
A badass list of frontend development resources I collected over time.
@BlakeGardner
BlakeGardner / Install HTTPie.md
Last active November 5, 2020 08:43
Install HTTPie Mac OS X

This is a quick guide on installing HTTPie for Mac OS X systems. This is also useful if you want the python package management utility pip. An installed copy of Homebrew is a prerequisite.

HTTPie

The easy way

brew install httpie
@marcusschiesser
marcusschiesser / HttpUtils.java
Created April 27, 2013 19:22
Simple Http client class for doing REST-style request with Android
import org.codehaus.jackson.map.ObjectMapper;
public class HttpUtils {
private static final int SERVER_PORT = 80;
private static final String SERVER_IP = "myapp.appspot.com"; // use 10.0.2.2 for emulator
private static HttpUtils instance = new HttpUtils();
private DefaultHttpClient client;
private ResponseHandler<String> responseHandler;