Skip to content

Instantly share code, notes, and snippets.

View OneOfOne's full-sized avatar
🐧
Focusing

Ahmed W. OneOfOne

🐧
Focusing
View GitHub Profile
@OneOfOne
OneOfOne / arch.md
Last active January 10, 2019 04:30
Installing Arch Linux For Dummies!
package main
import (
"log"
"os"
"os/exec"
"golang.org/x/net/ipv4"
"github.com/songgao/water"
@OneOfOne
OneOfOne / api-fetch-helper.ts
Created April 18, 2018 15:52
Smaller wrapper over fetch
export let API_BASE: string = '/api/v1/';
export type FetchBodyType = Blob | Int8Array | Int16Array | Int32Array | Uint8Array |
Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array |
DataView | ArrayBuffer | FormData | string | null;
export type PayloadFn = (h: Headers) => FetchBodyType;
export type PayloadType = Blob | FormData | string | object | PayloadFn;
#!/bin/sh
die() {
echo $1
exit $2
}
if [ "$1" = "update-vsc" ]; then
tmp="/tmp/vscode"
typ="stable"
[ "$2" != "" ] && typ="$2"
config_version 1.2
snapshot_root /media/storage/backup/
cmd_cp /usr/bin/cp
cmd_rm /usr/bin/rm
cmd_rsync /usr/bin/rsync
cmd_logger /usr/bin/logger
cmd_du /usr/bin/du
cmd_rsnapshot_diff /usr/bin/rsnapshot-diff
interval daily 7
verbose 2
@OneOfOne
OneOfOne / vsc.sh
Created April 6, 2017 16:19
VSCode launcher / updater for the lazy.
#!/bin/sh
if [ "$1" = "update-vsc" ]; then
typ="stable"
[ "$2" != "" ] && typ="$2"
pushd /usr/src
rm -rf VSCode-linux-x64.working &>/dev/null
mv VSCode-linux-x64 VSCode-linux-x64.working &>/dev/null
echo curl -L https://vscode-update.azurewebsites.net/latest/linux-x64/$typ
curl -L https://vscode-update.azurewebsites.net/latest/linux-x64/$typ | tar vxz && exit 0
@OneOfOne
OneOfOne / My vscode + eslint configs
Last active April 25, 2018 06:54
VSCode Settings
.
@OneOfOne
OneOfOne / functions.php
Last active September 21, 2016 20:02
a simple func to do curl json requests for those living in the stone age without php streams
<?php
function doCurlJSONReq($url, $data = null, $method = '', $returnString = false) {
//echo $url . "\n";
$ch = curl_init($url);
if($data !== null) {
if($method === '') $method = 'POST';
if(!is_string($data)) $data = json_encode($data);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-length: '.strlen($data)));
@OneOfOne
OneOfOne / fake-webcam.service
Created June 24, 2016 11:04
a systemd service using v4l2loopback and ffmpeg to fake a lower resolution webcam for skype, because skype murders my bandwidth.
[Unit]
Description=fake webcam
[Service]
ExecStartPre=/bin/modprobe v4l2loopback card_label='Skype Sucks'
ExecStart=/usr/bin/ffmpeg -loglevel panic -f v4l2 -video_size 640x360 -i /dev/video0 -f v4l2 -vf scale=320:-1 -r 10 /dev/video1
SuccessExitStatus=255
Restart=always
RestartSec=2
@OneOfOne
OneOfOne / git-push-new.sh
Last active November 29, 2021 22:44
git-push-new a little git helper to push a new branch and create a pull request.
#!/bin/bash
BRANCH=$(git symbolic-ref --short HEAD)
if echo $BRANCH | grep -q master; then
echo no master pushing
exit 1
fi
args=""
nopr=0
for arg in "$@"; do