Skip to content

Instantly share code, notes, and snippets.

View travisperson's full-sized avatar
🏠
Working from home

Travis Person travisperson

🏠
Working from home
View GitHub Profile
@travisperson
travisperson / arch-mirror.service
Created March 29, 2018 16:35 — forked from gdamjan/arch-mirror.service
script to rsync from an arch mirror
[Unit]
Description=Mirror arch linux
[Service]
Type=oneshot
ExecStart=/home/arch/sync_arch_mirror.sh
User=arch
IPAccounting=yes
NoNewPrivileges=yes
PrivateTmp=yes
@travisperson
travisperson / i3-shell.sh
Created June 16, 2017 17:59 — forked from viking/i3-shell.sh
Bash script for i3 to run a terminal in the same working directory as the current focused application
#!/bin/bash
# i3 thread: https://faq.i3wm.org/question/150/how-to-launch-a-terminal-from-here/?answer=152#post-id-152
CMD=xterm
CWD=''
# Get window ID
ID=$(xdpyinfo | grep focus | cut -f4 -d " ")
# Get PID of process whose window this is
@travisperson
travisperson / Enhance.js
Created October 17, 2016 22:23 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@travisperson
travisperson / Install_Sublime_Text_3_64.sh
Last active August 29, 2015 14:27 — forked from dkd903/Install_Sublime_Text_3_64.sh
Install Sublime Text 3 editor on Fedora Linux & Red Hat Linux - 64 Bit Edition. More at: http://digitizor.com/?p=15885
#!/bin/sh
SHORTCUT="[Desktop Entry]
Name=Sublime Text 3
Comment=Edit text files
Exec=/usr/local/sublime-text-3/sublime_text
Icon=/usr/local/sublime-text-3/Icon/128x128/sublime_text.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Utility;TextEditor;"
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
package main
import (
"github.com/gin-gonic/gin"
//"github.com/libgit2/git2go"
"fmt"
"os"
"os/exec"
)
@travisperson
travisperson / main.go
Last active August 29, 2015 14:07 — forked from anonymous/file1.txt
package main
import (
"github.com/gin-gonic/gin"
"fmt"
)
type GithubUser struct {
Name string `json:name`
Email string `json:email`
Username string `json:username`

Multi-series line chart rendered using React and D3.

function compStr(a, b)
{
return lcSubString2(a, b)/(a.length > b.length ? a.length : b.length);
}
function lcSubString2(_a, _b)
{
var max = "";
var maxai = 0;
@travisperson
travisperson / for shortcut
Created October 5, 2012 22:12 — forked from whyrusleeping/for shortcut
My favorite Pre-processor hackery
#include <stdio.h>
#define to ; i <=
#define DO(range) for(int range; i++)
int main()
{
int arr[10];
DO(i = 0 to 9)