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 / main.rs
Last active January 5, 2024 21:04
hashed password in rust
use base64::{
engine::{general_purpose, GeneralPurpose},
Engine as _,
};
use rand::{thread_rng, Rng as _};
use sha2::{Digest as _, Sha256};
const B64: GeneralPurpose = general_purpose::URL_SAFE_NO_PAD;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@OneOfOne
OneOfOne / kwinrulesrc
Last active May 28, 2022 16:38
kwin rules for ultrawide screen with common windows 2x(2/1)x1x1
[$Version]
update_info=kwinrules.upd:replace-placement-string-to-enum,kwinrules.upd:use-virtual-desktop-ids,kwinrules.upd:remove-placement-cascade
[1]
Description=Overwatch
clientmachine=localhost
noborder=true
noborderrule=2
position=2560,0
size=3380,1440
@OneOfOne
OneOfOne / ledmap.h
Last active February 25, 2022 04:38
zsa moonlander ledmap macro
#pragma once
#include "color.h"
#define TEAL { HSV_TEAL }
#define GOLD { HSV_GOLDENROD }
#define ORNG { HSV_ORANGE }
#define BLCK { HSV_ORANGE }
#define KEYS_TO_LEDS( \
diff --git a/src/runtime/crash_test.go b/src/runtime/crash_test.go
index e0c0bac892..7bbe19aafb 100644
--- a/src/runtime/crash_test.go
+++ b/src/runtime/crash_test.go
@@ -8,7 +8,6 @@ import (
"bytes"
"flag"
"fmt"
- "internal/testenv"
"os"
@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
#!/bin/sh
function convert() {
local fp="$(realpath "$1")"
local d=""
if [ -d "$fp" ]; then
d="$fp"
fp="$d/*.xlsx"
else
d="$(dirname "$fp")"
@OneOfOne
OneOfOne / vpn-ns.sh
Last active May 2, 2021 21:33
a script to run a vpn inside a network namespace with a shell
#!/bin/sh
set -uf
# set -x
# inspired by https://gist.github.com/dpino/6c0dca1742093346461e11aa8f608a99
NS="${NS-vpnns}"
if grep -q "$NS /sys" /proc/self/mounts; then
echo "already running inside the namespace"
@OneOfOne
OneOfOne / go-scratch.sh
Last active September 28, 2020 20:22
A little script to make a temp scratch dir with go2 support (aka a mini go2 playground with your favorite editor)
#!/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
@OneOfOne
OneOfOne / 10-go.conf
Created September 12, 2020 22:18
/etc/nginx/sites.d/01-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 / xonshrc.py
Last active July 30, 2020 02:16
my ~/.xonshrc
from builtins import __xonsh_env__
from subprocess import check_output, PIPE, CalledProcessError
from xonsh.tools import get_sep, XonshError
from os import listdir
from os.path import exists as pexists, join as pjoin, isfile
from collections import defaultdict, OrderedDict
def _branch_status(cwd=None):
branch = None
dirty = 0