Skip to content

Instantly share code, notes, and snippets.

View oss92's full-sized avatar
:octocat:
Focusing

Mohamed Osama oss92

:octocat:
Focusing
View GitHub Profile
@oss92
oss92 / semantic-commit-messages.md
Created January 13, 2022 09:03 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@oss92
oss92 / renew-gpgkey.md
Created September 30, 2021 13:01 — forked from krisleech/renew-gpgkey.md
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

@oss92
oss92 / main.py
Created July 17, 2019 15:49 — forked from stewartadam/main.py
Simple Python proxy server based on Flask and Requests with support for GET and POST requests.
"""
A simple proxy server, based on original by gear11:
https://gist.github.com/gear11/8006132
Modified from original to support both GET and POST, status code passthrough, header and form data passthrough.
Usage: http://hostname:port/p/(URL to be proxied, minus protocol)
For example: http://localhost:5000/p/www.google.com
"""
import re
#2968C2,#00337a,#144869,#FFFFFF,#0077ff,#FFFFFF,#5bf700,#00ffdd
@oss92
oss92 / RetrierTest.java
Created July 4, 2018 12:49 — forked from abyx/RetrierTest.java
Simple JUnit rule to make tests retry
public class RetrierTest {
private static int count = 0;
@Rule public RetryRule rule = new RetryRule();
@Test
@Retry
public void failsFirst() throws Exception {
count++;
assertEquals(2, count);
@oss92
oss92 / delay.js
Created March 5, 2018 17:58 — forked from daliborgogic/delay.js
Node.js Async/Await delay
'use strict'
const timeout = ms => new Promise(res => setTimeout(res, ms))
function convinceMe (convince) {
let unixTime = Math.round(+new Date() / 1000)
console.log(`Delay ${convince} at ${unixTime}`)
}
async function delay () {
@oss92
oss92 / clearTable.sh
Created February 2, 2018 15:52 — forked from pushplay/clearTable.sh
Delete all items (clear) in a DynamoDB table using bash
#!/bin/bash
TABLE_NAME=TableName
KEY=id
aws dynamodb scan --table-name $TABLE_NAME --attributes-to-get "id" --query "Items[].id.S" --output text | tr "\t" "\n" | xargs -t -I keyvalue aws dynamodb delete-item --table-name $TABLE_NAME --key '{"id": {"S": "keyvalue"}}'
@oss92
oss92 / CopySQS.py
Created December 17, 2017 22:04 — forked from Vidimensional/CopySQS.py
Copy between different SQS queues.
#!/usr/bin/env python
import json
import time
import argparse
import boto.sqs
from termcolor import cprint
@oss92
oss92 / signal_catching.rb
Created September 5, 2017 10:17 — forked from sauloperez/signal_catching.rb
How to catch SIGINT and SIGTERM signals in Ruby
# Signal catching
def shut_down
puts "\nShutting down gracefully..."
sleep 1
end
puts "I have PID #{Process.pid}"
# Trap ^C
Signal.trap("INT") {
static void
rb_check_deadlock(rb_vm_t *vm)
{
int found = 0;
rb_thread_t *th = 0;
if (vm_living_thread_num(vm) > vm->sleeper) return;
if (vm_living_thread_num(vm) < vm->sleeper) rb_bug("sleeper must not be more than vm_living_thread_num(vm)");
if (patrol_thread && patrol_thread != GET_THREAD()) return;