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"
#!/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 / 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 / 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

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 January 16, 2019 23:46
ant.design getFieldDecorator wrapper
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;