Skip to content

Instantly share code, notes, and snippets.

View alejandrobernardis's full-sized avatar
🐻

Alejandro M. BERNARDIS alejandrobernardis

🐻
View GitHub Profile
@narze
narze / gh-add-repos-to-team.sh
Created July 22, 2022 08:33
Add repos to team with gh
#!/bin/bash
PERMISSION="push" # Can be one of: pull, push, admin, maintain, triage
ORG="orgname"
TEAM_SLUG="your-team-slug"
# Get names with `gh repo list orgname`
REPOS=(
"orgname/reponame"
)
@stiff
stiff / type-level-routes.cpp
Last active September 26, 2021 15:25
Type level routes in C++20
// loosely based on https://servant.dev
// /usr/local/Cellar/gcc/10.2.0/bin/g++-10 -std=c++20 type-level-routes.cpp && ./a.out
#include <iostream>
#include <string>
// FixedString from https://www.reddit.com/r/cpp/comments/bhxx49/c20_string_literals_as_nontype_template/
template<unsigned N>
struct FixedString {
@alejandrobernardis
alejandrobernardis / installer.zsh
Last active June 8, 2020 03:09
Generic installer
#!/bin/zsh
# Author: Alejandro M. BERNARDIS
# Email alejandro.bernardis at gmail dot com
# Created: 2020-06-07
### debug ######################################################################
typeset -gr LOG_LEVEL_OFF=0
typeset -gr LOG_LEVEL_FATAL=1
typeset -gr LOG_LEVEL_CRITICAL=2
@bittner
bittner / keyboard-keys.md
Created February 28, 2019 22:50
Keyboard keys markup in MarkDown

Ctrl + Alt + Space

@RebeccaWhit3
RebeccaWhit3 / Keyboard HTML Tag for Github Markdown.md
Created March 14, 2017 02:12
Keyboard HTML Tag for Github Markdown

Keyboard HTML Tag for Github Markdown

Examples:

control + shift + space

command/control + ,

👆/👇/👈/👉

@infra-0-0
infra-0-0 / dns.py
Last active September 30, 2020 14:47
python3.5 asyncio dns resolver, based on code from who knows where
"""
The most simple DNS client written for Python with asyncio:
* Only A record is support (no CNAME, no AAAA, no MX, etc.)
* Almost no error handling
* Doesn't support fragmented UDP packets (is it possible?)
"""
import asyncio
import logging
@ajdavis
ajdavis / deadlock2.py
Created April 15, 2015 13:37
Demonstrate the interaction between GC and threading in Python. Followup to http://emptysqua.re/blog/pypy-garbage-collection-and-a-deadlock/
import threading
import gc
from time import sleep
lock = threading.RLock()
def target():
print 'target'
with lock:
sleep(2)
@ajdavis
ajdavis / pygrep.py
Created February 26, 2015 21:04
Has an "-o" option to show only the matching portion of a line. Adapted from Batchelder: http://nedbatchelder.com/code/utilities/pygrep.py
#!/usr/bin/python
"""
Usage: grep [OPTION]... PATTERN [FILE] ...
Search for PATTERN in each FILE or standard input.
Example: grep -i 'hello world' menu.h main.c
Regexp selection and interpretation:
-E, --extended-regexp PATTERN is an extended regular expression
-F, --fixed-strings PATTERN is a set of newline-separated strings
-G, --basic-regexp PATTERN is a basic regular expression
@bdarnell
bdarnell / run.py
Created February 25, 2015 03:14
Python yield_loop macro
import macropy.activate
import test
@bdarnell
bdarnell / ssltest.py
Created May 24, 2014 16:26
Test case for interrupted SSL handshake
import contextlib
import os.path
import socket
import ssl
import unittest
from tornado.iostream import SSLIOStream
from tornado import netutil, testing
from tornado.testing import AsyncTestCase, bind_unused_port