Skip to content

Instantly share code, notes, and snippets.

Avatar
🐧
Focusing

Ahmed W. OneOfOne

🐧
Focusing
View GitHub Profile
@OneOfOne
OneOfOne / 10-go.conf
Created Sep 12, 2020
/etc/nginx/sites.d/01-go.conf
View 10-go.conf
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name go.oneofone.dev;
include conf.d/ssl.conf; # config with ssl config
location ~* /([^/]+) { # match the first part of the path, we only need that
set $pkg "$1";
set $fullURI '$server_name$uri';
set $pkgURI '$server_name/$pkg';
@OneOfOne
OneOfOne / go-scratch.sh
Last active Sep 28, 2020
A little script to make a temp scratch dir with go2 support (aka a mini go2 playground with your favorite editor)
View go-scratch.sh
#!/bin/bash
set -e
EDITOR="code --new-window --wait "
GOPATH="$(go env GOPATH)"
BASE="$GOPATH/src/tmp/"
ARG=${1:-go}
if [ $ARG = "-d" ]; then
echo -n "delete '$BASE'? " && read Y
View disney.md

The power of Disney...🤨

  • 1995: Disney buys ABC

  • 2006: Disney buys Pixar

  • 2009: Disney enters 30 film deal with Dreamworks

  • 2009: Disney buys Marvel

@OneOfOne
OneOfOne / formitem.js
Created Jan 16, 2019
ant.design getFieldDecorator wrapper
View formitem.js
import React from 'react';
import { Input, Checkbox, Select } from 'antd';
const FormField = (props) => {
let { hidden, form, name, required = false, message = '', valuePropName = 'value', initialValue, type, ...rest } = props,
{ getFieldDecorator } = form;
if (hidden) return null;
let Child = null;
@OneOfOne
OneOfOne / arch.md
Last active Jan 10, 2019
Installing Arch Linux For Dummies!
View arch.md
View tun.go
package main
import (
"log"
"os"
"os/exec"
"golang.org/x/net/ipv4"
"github.com/songgao/water"
@OneOfOne
OneOfOne / api-fetch-helper.ts
Created Apr 18, 2018
Smaller wrapper over fetch
View api-fetch-helper.ts
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;
View vsc.sh
#!/bin/sh
die() {
echo $1
exit $2
}
if [ "$1" = "update-vsc" ]; then
tmp="/tmp/vscode"
typ="stable"
[ "$2" != "" ] && typ="$2"
View rsnapshot.conf
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 Apr 6, 2017
VSCode launcher / updater for the lazy.
View vsc.sh
#!/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
You can’t perform that action at this time.