Skip to content

Instantly share code, notes, and snippets.

View blakejakopovic's full-sized avatar

Blake Jakopovic blakejakopovic

View GitHub Profile
(ns react-cljs.core
(:require React))
(declare render)
(defn handle-change [e]
(render {:text (.. e -target -value)}))
(defn render [{:keys [text]}]
(React/renderComponent
@chrishulbert
chrishulbert / bcastpacket.m
Created April 6, 2011 01:23
Send a broadcast udp message using c / obj-c
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h>
#include <arpa/inet.h>
- (void)sendBroadcastPacket {
// Open a socket
int sd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (sd<=0) {
NSLog(@"Error: Could not open socket");
@jorgenisaksson
jorgenisaksson / gist:76a8dae54fd3dc4e31c2
Created June 10, 2014 18:01
Create a CGPath from an NSBezierPath in Swift. Great for CALayers for example.
// Adapted from Cocoa Drawing Guide's "Create a CGPathRef fram an NSBezierPath Object"
func CGPathFromNSBezierPath(nsPath: NSBezierPath) -> CGPath! {
if nsPath.elementCount == 0 {
return nil
}
let path = CGPathCreateMutable()
var didClosePath = false
#!/bin/bash
SLEEP=`echo "$1*3600" | bc`
echo "Alarm triggered in $1 hours"
sleep $SLEEP > /dev/null
echo "Starting playing"
mpc volume 50 > /dev/null
mpc play > /dev/null
mpcfade.sh 50 65 0
mpcfade.sh 65 75 1
echo "Turning on TV and switching input to me"
@mattmcnabb
mattmcnabb / Test-ADStaffAttributes.ps1
Last active February 11, 2018 06:58
Line-Of-BusinessTesting
function Test-ADStaffAttributes {
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)]
[Microsoft.ActiveDirectory.Management.ADUser]
$Identity,
[switch]
$Quiet
@electronut
electronut / showdata.py
Created May 24, 2013 07:44
Display analog data from Arduino using Python (matplotlib)
################################################################################
# showdata.py
#
# Display analog data from Arduino using Python (matplotlib)
#
# electronut.in
#
################################################################################
import sys, serial
@subdigital
subdigital / xc
Created April 19, 2013 14:27
Open the first Xcode workspace or project found
xcode_proj=`find . -name "*.xc*" -d 1 | sort -r | head -1`
if [ `echo -n $xcode_proj | wc -m` == 0 ]
then
echo "No xcworkspace/xcodeproj file found in the current directory."
exit 1
fi
echo "Found $xcode_proj"
open $xcode_proj
@ruel
ruel / infb.py
Created November 26, 2010 12:07
A script to scrape information from your facebook friends.
#!/usr/bin/python
'''
InFB - Information Facebook
Usage: infb.py user@domain.tld password
http://ruel.me
Copyright (c) 2011, Ruel Pagayon
All rights reserved.
@darrenpmeyer
darrenpmeyer / openconnect_osx_howto.md
Last active October 18, 2018 17:07
Building OpenConnect for OS X with stoken and GnuTLS

This guide helps you build OpenConnect 7.x on OS X. You might want to do this if you want a newer version than the openconnect package in homebrew provides, or if you want to use libstoken support (for having an RSA soft token on your machine be used automatically by OpenConnect).

Shortcut

The version of OpenConnect on Homebrew has been updated, and so this whole guide can now be replaced with:

  1. Install Homebrew from http://brew.sh and make sure it works
  2. brew install openconnect --with-stoken
  3. brew install stoken (See the "Using OpenConnect" section below for information about using stoken to set up soft tokens)
@mxgrn
mxgrn / gist:663933
Created November 5, 2010 10:24
Git's pre-commit hook to remove trailing whitespaces/tabs
#!/bin/sh
#
# This will abort "git commit" and remove the trailing whitespaces from the files to be committed.
# Simply repeating the last "git commit" command will do the commit then.
#
# Put this into .git/hooks/pre-commit, and chmod +x it.
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else