Skip to content

Instantly share code, notes, and snippets.

View abenezerBelachew's full-sized avatar
🐎
What weighs more? A 200 kg horse or a 200 kg mattress?

Abenezer Belachew abenezerBelachew

🐎
What weighs more? A 200 kg horse or a 200 kg mattress?
View GitHub Profile
@abenezerBelachew
abenezerBelachew / .block
Created March 7, 2020 21:50
StudentDevCon2020 Workshop Sandbox
license: mit
@abenezerBelachew
abenezerBelachew / .block
Created March 8, 2020 02:29
(Solution) StudentDevCon2020 Workshop Sandbox
license: mit
@abenezerBelachew
abenezerBelachew / .block
Created March 8, 2020 02:31
(Solution) StudentDevCon2020 Workshop Sandbox
license: mit
@abenezerBelachew
abenezerBelachew / clone_organization_repos.py
Created April 21, 2023 20:34
A simple python script to clone the repositories in an organization.
import os
import requests
# Set the GitHub organization and access token
org = "" # 'getsentry' for example
access_token = ""
# Set the base URL for the GitHub API
base_url = 'https://api.github.com/orgs/{}/repos'.format(org)
@abenezerBelachew
abenezerBelachew / gist:ba05fe59c0fa3e2ffc6fb01c6add01ed
Created December 31, 2023 21:19
.vscode/settings.json [python]
{
"python.analysis.typeCheckingMode": "basic",
"python.analysis.autoImportCompletions": true,
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
},
from http.server import BaseHTTPRequestHandler, HTTPServer
import json
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-type', 'application/json')
self.end_headers()
response = {
@abenezerBelachew
abenezerBelachew / p5
Created March 7, 2024 00:05
top 5 processes (cpu/mem)
alias p5="ps -eo comm,pcpu --sort -pcpu | head -6; ps -eo comm,pmem --sort -pmem | head -6"
CREATE OR REPLACE FUNCTION insta5.next_id(OUT result bigint) AS $$
DECLARE
our_epoch bigint := 1314220021721;
seq_id bigint;
now_millis bigint;
shard_id int := 5;
BEGIN
SELECT nextval('insta5.table_id_seq') %% 1024 INTO seq_id;
SELECT FLOOR(EXTRACT(EPOCH FROM clock_timestamp()) * 1000) INTO now_millis;
result := (now_millis - our_epoch) << 23;
@abenezerBelachew
abenezerBelachew / go-stdlib-interface-selected.md
Created May 19, 2024 18:37 — forked from asukakenji/go-stdlib-interface-selected.md
Go (Golang) Standard Library Interfaces (Selected)

Go (Golang) Standard Library Interfaces (Selected)

This is not an exhaustive list of all interfaces in Go's standard library. I only list those I think are important. Interfaces defined in frequently used packages (like io, fmt) are included. Interfaces that have significant importance are also included.

All of the following information is based on go version go1.8.3 darwin/amd64.