Skip to content

Instantly share code, notes, and snippets.

View bheesham's full-sized avatar
🦥
yes

Bheesham Persaud bheesham

🦥
yes
View GitHub Profile
PROJECTS_DIR=$HOME/projects
function workon {
cd $PROJECTS_DIR/"$1"/;
cd "$1" > /dev/null 2>&1 && source ../bin/activate > /dev/null 2>&1;
}
complete -W '`ls $PROJECTS_DIR`' workon
@datagrok
datagrok / git-serve.md
Last active April 21, 2023 07:33
How to easily launch a temporary one-off git server from any local repository, to enable a peer-to-peer git workflow.
@swarminglogic
swarminglogic / watchfile.sh
Last active March 4, 2024 14:44
watchfile - monitor file(s) and execute a command when files are changed
#!/bin/bash
version=1.0.1
versionDate="2014-02-14"
function showHelp() {
echo "watchfile - monitor file(s)/command and perform action when changed
Possible ways of usage
----------------------------------------
@grugq
grugq / gist:03167bed45e774551155
Last active April 6, 2024 10:12
operational pgp - draft

Operational PGP

This is a guide on how to email securely.

There are many guides on how to install and use PGP to encrypt email. This is not one of them. This is a guide on secure communication using email with PGP encryption. If you are not familiar with PGP, please read another guide first. If you are comfortable using PGP to encrypt and decrypt emails, this guide will raise your security to the next level.

@Manouchehri
Manouchehri / config
Created March 7, 2015 18:15
.ssh/config
Host *
ControlMaster auto
ControlPath /home/dave/.ssh/sockets/%r@%h-%p
ControlPersist 8760h
ServerAliveInterval 5
ServerAliveCountMax 1
Host *.mun.ca
User dave
IdentityFile /home/dave/.ssh/keymun
@CarlEkerot
CarlEkerot / ssl_bio.c
Created January 14, 2016 15:35
SSL BIO example
#include <openssl/ssl.h>
/**
* This example demonstrates how to set up a simple SSL BIO filter on an
* existing connect BIO. This is useful in sutiations where cleartext
* communication is upgraded to ciphertext communication.
*
* Compile with:
* gcc ssl_bio.c -lcrypto -lssl -o ssl_bio
*/
@avafloww
avafloww / PhpJava.java
Last active June 13, 2024 07:36
This snippet of code is syntactically valid in both PHP and Java, and produces the same output in both.
/*<?php
//*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s",
//\u000A\u002F\u002A
class PhpJava {
static function main() {
echo(//\u000A\u002A\u002F
"Hello World!");
}}
//\u000A\u002F\u002A
PhpJava::main();
@jkomyno
jkomyno / sockaddr_tostr.h
Last active December 20, 2023 00:50
Convert a struct sockaddr address to a string, IPv4 and IPv6
// Convert a struct sockaddr address to a string, IPv4 and IPv6:
char *get_ip_str(const struct sockaddr *sa, char *s, size_t maxlen)
{
switch(sa->sa_family) {
case AF_INET:
inet_ntop(AF_INET, &(((struct sockaddr_in *)sa)->sin_addr),
s, maxlen);
break;