Skip to content

Commit 8c7c5f2

Browse files
committed
everything
0 parents  commit 8c7c5f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1162
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
npm
2+
custom
3+
override

.snippets/react-component

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Component }, React from 'react'
2+
3+
export default class $classname extends Component {
4+
render() {
5+
return <div></div>
6+
}
7+
}

.snippets/react-component-mobx.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Component }, React from 'react'
2+
import { observer } from 'mobx-react'
3+
import { observable } from 'react'
4+
5+
export default class $classname extends Component {
6+
render() {
7+
return <div></div>
8+
}
9+
}

.snippets/react-component.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Component }, React from 'react'
2+
3+
export default class $classname extends Component {
4+
render() {
5+
return <div></div>
6+
}
7+
}

.snippets/react-mobx-component

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Component }, React from 'react'
2+
import { observer } from 'mobx-react'
3+
import { observable } from 'react'
4+
5+
export default class $classname extends Component {
6+
render() {
7+
return <div></div>
8+
}
9+
}
10+

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# dotfiles
2+
3+
### To Run
4+
5+
`wget https://gitlab.com/zwhitchcox/zetup/raw/master/init.sh && source init.sh`
6+
7+
OR
8+
9+
`curl https://gitlab.com/zwhitchcox/zetup/raw/master/init.sh && source init.sh`
10+
11+
### within container
12+
13+
`apt update && apt install wget -y && wget https://gitlab.com/zwhitchcox/zetup/raw/master/init.sh && source init.sh`

UltiSnips/go.snippets

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
snippet errgin
2+
if err != nil {
3+
c.JSON(406, gin.H{"message": err.Error()})
4+
c.Abort()
5+
return
6+
}
7+
endsnippet
8+
9+
snippet user_id
10+
user_id, err := signedin.SignedIn(c)
11+
if err != nil {
12+
c.String(406, err.Error())
13+
c.Abort()
14+
return
15+
}
16+
endsnippet
17+
18+
snippet db
19+
db := db.DB()
20+
endsnippet
21+
22+
snippet Exec
23+
_, err = db.Exec("$1")
24+
if err != nil {
25+
c.String(406, "$2")
26+
return
27+
}
28+
endsnippet
29+
30+
snippet UPDATE
31+
_, err = db.Exec("UPDATE $1 SET $2 WHERE $3")
32+
33+
if err != nil {
34+
c.String(406, "$4")
35+
return
36+
}
37+
38+
endsnippet
39+
40+
snippet err
41+
if err != nil {
42+
$1
43+
}
44+
endsnippet
45+
46+
snippet httperr
47+
if err != nil {
48+
http.Error(w, err.Error(), http.StatusInternalServerError)
49+
}
50+
endsnippet

UltiSnips/javascript.snippets

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# console.log with variable
2+
3+
snippet lf "console.log"
4+
console.log("${1:${VISUAL}} = ", $1)
5+
endsnippet
6+
snippet lm "console.log"
7+
console.log("toJS(${1:${VISUAL}}) = ", toJS($1))
8+
endsnippet
9+
10+
snippet ln "console.log"
11+
console.log("$1")
12+
endsnippet
13+
14+
15+
snippet iifea "asynchronous iife"
16+
;(async () => {
17+
$1
18+
})()
19+
endsnippet
20+
21+
snippet store "get store from props"
22+
const { store } = this.props
23+
endsnippet
24+
25+
snippet classes "get classes from props"
26+
const { classes } = this.props
27+
endsnippet
28+
29+
snippet cmpt "mobx react component"
30+
import React from 'react'
31+
import { inject, observer } from 'mobx-react'
32+
33+
@inject('store')
34+
@observer
35+
export class $1 extends React.Component {
36+
render() {
37+
return <div></div>
38+
}
39+
}
40+
endsnippet
41+
42+
snippet express-server "express server"
43+
require('source-map-support').install()
44+
const express = require('express')
45+
const bodyParser = require('body-parser')
46+
47+
const app = express()
48+
49+
process.on('unhandledRejection', (reason, p) => \{
50+
console.error('Unhandled Rejection at:', p, 'reason:', reason)
51+
process.exit(1)
52+
\})
53+
54+
const html = \`
55+
<!doctype html>
56+
<html>
57+
<head>
58+
<title></title>
59+
<link href="/main.css" rel="stylesheet" />
60+
</head>
61+
<body>
62+
<app></app>
63+
<script src="/client.js"></script>
64+
</body>
65+
</html>
66+
67+
\`.trim()
68+
69+
app.use(bodyParser.json())
70+
app.use(bodyParser.text())
71+
72+
app.use(express.static("./build"))
73+
app.use((req, res) => res.status(200).end(html))
74+
75+
app.listen(3000, ()=> console.log("listening on 3000"))
76+
endsnippet

bin/backlight

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
#
3+
# Simple script to turn on/off the keyboard backlight of a Cromebook with
4+
# the leds_chromeos_keyboard Kernel driver. See my patches to get this driver
5+
# into a custom Kernel as it is not included by default.
6+
# See https://github.com/longsleep/linux_patches/tree/pixel
7+
#
8+
# The backlight can only be changed as root, thus sudo is used in this script.
9+
# To make this work, add the following like to your sudoes file
10+
# ALL ALL = (ALL) NOPASSWD: /usr/bin/tee /sys/class/leds/chromeos\:\:kbd_backlight/brightness
11+
#
12+
# Thats it.
13+
#
14+
# This script was written by Simon Eisenmann <[email protected]> in 2015.
15+
16+
17+
if [ "$1" = "" ]; then
18+
echo "$0 [on/off/toggle]"
19+
exit 1
20+
fi
21+
22+
MODE=$1
23+
DEVFILE=/sys/class/leds/chromeos\:\:kbd_backlight/brightness
24+
25+
VALUE=0
26+
CURR=`cat $DEVFILE`
27+
28+
if [ "$MODE"x == "on"x ]; then
29+
VALUE=100
30+
fi
31+
32+
if [ "$MODE"x == "toggle"x ]; then
33+
if [ "$CURR" == "100" ]; then
34+
VALUE=0
35+
else
36+
VALUE=100
37+
fi
38+
fi
39+
40+
41+
echo $VALUE | sudo /usr/bin/tee $DEVFILE

bin/changemac

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
devname="$1"
4+
fakemac=$(sh ./spoofmac)
5+
echo "powering down $devname"
6+
ip link set dev $devname down
7+
sleep 1
8+
ip link show $devname
9+
echo "setting fake mac address $fakemac"
10+
ip link set dev $devname addr $fakemac
11+
echo "turning $devname back on"
12+
sleep 1
13+
ip link set dev $devname up
14+
sleep 1
15+
ip link show $devname

bin/create-migration.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
mkdir -p migrations
3+
cd migrations
4+
filename="$(date +%s)_$1"
5+
touch "$filename"_up.sql
6+
touch "$filename"_down.sql

bin/dev

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
cd $HOME/dev
3+
PROJ="$1"
4+
set -- $(stty size) # $1 = rows $2 = columns
5+
tmux -2 new-session -d -s "$PROJ" -x "$2" -y "$(($1 - 1))"
6+
tmux split-window -t "$PROJ" -v
7+
tmux resize-pane -t "$PROJ" -y "10"
8+
tmux select-pane -t "1"
9+
tmux send-keys "cd $PROJ"
10+
tmux send-keys "Enter"
11+
tmux send-keys "vim"
12+
tmux send-keys "Enter"
13+
tmux select-pane -t "2"
14+
tmux send-keys "cd $PROJ"
15+
tmux send-keys "Enter"
16+
tmux send-keys "node serve"
17+
tmux send-keys "Enter"
18+
tmux select-pane -t "1"
19+
tmux new-window
20+
tmux previous-window
21+
tmux attach -t "$PROJ"

bin/distros/gallium-display

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
xrandr -s 2560x1440 --output DP1 --primary --left-of eDP1 --auto
3+

bin/distros/watch-for-monitor

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
#Add this to startup applications to make it work automatically
4+
while sleep 1; do
5+
6+
7+
if grep -qFv "disconnected" /sys/class/drm/card0-DP-1/status;
8+
then
9+
xrandr -s 2560x1440 --output eDP1 --off;
10+
xrandr -s 2560x1440 --output DP1 --primary --auto
11+
xinput list | grep maXTouch | sed -r 's/.*id=([0-9]+).*/\1/' | while read -r line; do xinput disable "$line"; done;
12+
pacmd set-default-sink "alsa_output.pci-0000_00_03.0.hdmi-stereo";
13+
samus-alsaenable-speakers >/dev/null;
14+
else
15+
xrandr -s 2560x1700 --output eDP1 --auto
16+
xinput list | grep maXTouch | sed -r 's/.*id=([0-9]+).*/\1/' | while read -r line; do xinput enable "$line"; done;
17+
pacmd set-default-sink "alsa_output.platform-bdw-rt5677.analog-stereo";
18+
samus-alsaenable-speakers >/dev/null;
19+
fi
20+
done

bin/docker-do

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
# --digitalocean-size s-8vcpu-32gb \
3+
docker-machine create --digitalocean-image ubuntu-18-04-x64 --driver digitalocean --digitalocean-access-token "$DOAT" "$1"

bin/docker-machine-rename

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
#copy this in a folder from path ex: /usr/local/bin
4+
#usage: docker-machine-rename default my-default
5+
6+
# Authors
7+
#
8+
# alexproca initial script
9+
# eurythmia sed magic
10+
11+
OLD_MACHINE_NAME=${1:-default};
12+
NEW_MACHINE_NAME=${2:-my-default-2};
13+
STORE_PATH=$(docker-machine inspect ${OLD_MACHINE_NAME} | sed -n 's/^ *"StorePath": "\(.*\)",/\1/p')
14+
15+
# 1. rename the directory of your docker-machine from docker machine store
16+
mv "$STORE_PATH/machines/$OLD_MACHINE_NAME" "$STORE_PATH/machines/$NEW_MACHINE_NAME";
17+
18+
# 2. update config.json with the new name and new path (always backup your configs)
19+
sed -i.bak "s/${OLD_MACHINE_NAME}/${NEW_MACHINE_NAME}/g" ${STORE_PATH}/machines/${NEW_MACHINE_NAME}/config.json
20+
21+
# 3. rename machine in the virtual machine provider
22+
vboxmanage modifyvm "$OLD_MACHINE_NAME" --name "$NEW_MACHINE_NAME"

bin/fingerguns

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
PS1='${PWD##*/} $ '
3+
echo "You can't just use finger guns as bash prompt."
4+
echo ""
5+
bn=$(basename $PWD)
6+
printf "%0.s " $(seq 1 ${#bn})
7+
echo -e " \xF0\x9F\x98\x8E That's where you're wrong, kiddo "
8+
PS1=$PS1$' \xF0\x9F\x91\x89\xF0\x9F\x91\x89 '
9+
PS1=$'${PWD##*/} \xF0\x9F\x91\x89\xF0\x9F\x98\x8E\xF0\x9F\x91\x89 '

bin/force-kill

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
# force kill process by port
3+
# Usage: "force-kill PORT"
4+
5+
sudo netstat -tulnp | grep "$1" | sed -r -e "s/.*LISTEN\\s+([0-9]+).*/\1/" | xargs sudo kill -9

bin/git/gitamend

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
git add . -A &&
3+
git commit --amend --no-edit &&
4+
git push origin $(
5+
if [ -z "$1" ] ;
6+
then echo $1 ;
7+
else echo master ;
8+
fi
9+
) -f

bin/git/gitpush

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
git add . -A
3+
git commit -m "$1"
4+
git push

bin/git/gittotaladdedlines

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
git log --numstat --pretty="" | grep -v lock | sed -r -e "s/^([0-9]+)\\s+([0-9]+).*/\1/" | grep -v "^-" | paste -sd+ | bc

bin/git/gittotalremovedlines

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
git log --numstat --pretty="" | grep -v lock | sed -r -e "s/^([0-9]+)\\s+([0-9]+).*/\2/" | grep -v "^-" | paste -sd+ | bc

bin/make-proj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
PROJ_NAME="$1"
3+
mkdir ~/dev/$PROJ_NAME
4+
cd ~/dev/$PROJ_NAME
5+
npm init -y
6+
git init
7+
echo "node_modules" > .gitignore
8+
git add . -A && git commit -m "initial commit"
9+
cd ~/dev
10+
dev "$PROJ_NAME"

bin/pfwd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
for i in ${@:2}
4+
do
5+
echo Forwarding port $i
6+
ssh -N -L $i:localhost:$i $1 &
7+
done

bin/pull-config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
$(cd ~/dotfiles && git pull origin master)
3+
echo "Pulled from dotfiles master"

bin/push-config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
cd ~/zetup
3+
gitpush "$1"

bin/showppa

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#! /bin/sh
2+
# listppa Script to get all the PPA installed on a system ready to share for reininstall
3+
for APT in `find /etc/apt/ -name \*.list`; do
4+
grep -o "^deb http://ppa.launchpad.net/[a-z0-9\-]\+/[a-z0-9\-]\+" $APT | while read ENTRY ; do
5+
USER=`echo $ENTRY | cut -d/ -f4`
6+
PPA=`echo $ENTRY | cut -d/ -f5`
7+
echo sudo apt-add-repository ppa:$USER/$PPA
8+
done
9+
done

0 commit comments

Comments
 (0)