Skip to content

Instantly share code, notes, and snippets.

View TruncatedDinoSour's full-sized avatar
🏳️‍⚧️

Ari Archer (migrated to https://git.ari.lt/ari) TruncatedDinoSour

🏳️‍⚧️
View GitHub Profile
@branneman
branneman / http-easy.rkt
Last active June 29, 2024 18:58
Racket: How to do HTTP requests
#lang racket/base
(require
net/http-easy)
(define (base-url path)
(string-append "https://httpbin.org" path))
; request: GET
; response: plain string body
@ttys3
ttys3 / gruvbox-material-alacritty.yml
Created January 16, 2021 03:33 — forked from sainnhe/gruvbox-material-alacritty.yml
Gruvbox Material for Alacritty
# The definition of color schemes.
schemes:
gruvbox_material_hard_dark: &gruvbox_material_hard_dark
primary:
background: '0x1d2021'
foreground: '0xd4be98'
normal:
black: '0x32302f'
red: '0xea6962'
green: '0xa9b665'
```cpp
// Sorry, I don't know which.
#define WIN32_MEAN_AND_LEAN
#define WIN32_LEAN_AND_MEAN
enum class FizzBuzzState : uint32_t
{
Fizz = 0b01,
Buzz = 0b10,
FizzBuzz = Fizz | Buzz
template <class _Ty>
_NODISCARD /* constexpr */ _Ty _Common_lerp(const _Ty _ArgA, const _Ty _ArgB, const _Ty _ArgT) noexcept {
// on a line intersecting {(0.0, _ArgA), (1.0, _ArgB)}, return the Y value for X == _ArgT
const int _Finite_mask = (int{isfinite(_ArgA)} << 2) | (int{isfinite(_ArgB)} << 1) | int{isfinite(_ArgT)};
if (_Finite_mask == 0b111) {
// 99% case, put it first; this block comes from P0811R3
if ((_ArgA <= 0 && _ArgB >= 0) || (_ArgA >= 0 && _ArgB <= 0)) {
// exact, monotonic, bounded, determinate, and (for _ArgA == _ArgB == 0) consistent:
return _ArgT * _ArgB + (1 - _ArgT) * _ArgA;
@GioBonvi
GioBonvi / fsct.py
Created September 6, 2019 09:44
A simple tool to decode, verify or generate a signed Flask session cookie. Useful during CTFs.
#!/usr/bin/env python3
# encoding: utf-8
"""
Flask session cookie toolkit.
Decode, verify or generate a signed Flask session cookie.
Credits to Terry Vogelsang for the original script (https://terryvogelsang.tech/MITRECTF2018-my-flask-app/)
which I just slightly modified for my personal use.
@gombru
gombru / FocalLoss.py
Last active August 5, 2024 20:28
Caffe Python layer Focal Loss implementation (From Focal Loss for Dense Object Detection, Facebook paper)
import caffe
import numpy as np
import json
class FocalLoss(caffe.Layer):
"""
Compute Focal Loss
Inspired by https://arxiv.org/abs/1708.02002
Raul Gomez Bruballa
https://gombru.github.io/
Basic
=====
[Shift]+[Mod]+[Enter] - launch terminal.
[Mod]+[b] - show/hide bar.
[Mod]+[p] - dmenu for running programs like the x-www-browser.
[Mod]+[Enter] - push acive window from stack to master, or pulls last used window from stack onto master.
[Mod] + [j / k] - focus on next/previous window in current tag.
@nepsilon
nepsilon / python-how-to-print-the-full-traceback-without-exiting-the-program.md
Created January 3, 2017 06:24
Python: How to print the full traceback without exiting the program? — First published in fullweb.io issue #81

Python: How to print the full traceback without exiting the program?

The exception handling block except Exception as ex: print(ex) will only print the exception message and not its traceback.

That’s good to know, but we need more info than this to debug properly. Namely the line that raised the exception, together with its stack trace.

The traceback module, part of the stdlib, will help us with this:

[~] rofi -dump-xresources
The script command 'window' has 1 options, but needs 2: <name>:<script>.
Invalid script switcher: window
! Enabled modi
rofi.modi: window,run,ssh
! Window opacity
rofi.opacity: 100
! Window width
rofi.width: 50
! Number of lines