Skip to content

Instantly share code, notes, and snippets.

@rkulla
rkulla / quickscan.pl
Last active December 29, 2022 05:39
Simple Perl-based Port Scanner
#!/usr/bin/perl
# Easy port scanner
# I wrote this in the 90s to help learn socket programming
# ./quickscan -h for usage
use Socket;
$| = 1; # so \r works right
my ($ip, $protocol, $port, $myhouse, $yourhouse, $log);
@Synchro
Synchro / gist:1139429
Created August 11, 2011 11:29
PHP Base-62 encoder/decoder
<?php
/**
* This is an example of a practical encoder and decoder for base-62 data in PHP
* It differs from the majority of examples in that it's fast enough for moderate data sizes, unlike multiprecision converters
* To be practical, base-62 encoding needs to use internal chunking and padding because base-62 does not fit exactly into any integral number of bits
* This means the output is not quite compatible with multiprecision conversions,
* but the encoded data retains all the desirable properties of base-62, so (unlike any base-64 encoding) it's URL, DNS, email address and pathname safe
* @author Marcus Bointon <marcus@synchromedia.co.uk>
* @copyright 2011 Marcus Bointon
* @license http://www.opensource.org/licenses/mit-license.html MIT License
@stvkoch
stvkoch / gist:3151248
Created July 20, 2012 15:11
Perl 1 line
Useful One-Line Scripts for Perl Jan 28 2012 | version 1.08
-------------------------------- ----------- ------------
Compiled by Peteris Krumins (peter@catonmat.net, @pkrumins on Twitter)
http://www.catonmat.net -- good coders code, great reuse
Latest version of this file is always at:
http://www.catonmat.net/download/perl1line.txt
@litzinger
litzinger / screencapture.sh
Last active November 17, 2023 07:30
Take screenshot every 5 minutes
First, create a couple new folders:
cd ~/
mkdir Scripts
mkdir Screenshots
cd Screenshots
mkdir cron
cd ~/Scripts
vim screencapture.sh
package main
import (
"fmt"
)
func decorator(f func(s string)) func(s string) {
return func(s string) {
fmt.Println("Started")
@ChengLong
ChengLong / add_swap.sh
Created October 26, 2014 08:12
Add 4GB swap and tweak swappiness and vfs cache pressure
# create a 4G swap file at /swapfile
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
# Make the Swap File Permanent
sudo echo "/swapfile none swap sw 0 0" >> /etc/fstab
# set swappiness to 10
@multidis
multidis / aws_s3_ls.sh
Last active March 22, 2024 07:30
List of files in a specific AWS S3 location in a shell script.
#!/bin/bash
# setup AWS CLI first
# http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html
# configure AWS CLI (e.g. use IAM role for S3 access)
export AWS_DEFAULT_REGION=us-east-1
export AWS_ACCESS_KEY_ID=IDHERE
export AWS_SECRET_ACCESS_KEY=KeyHere
@vasanthk
vasanthk / System Design.md
Last active July 3, 2024 16:14
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@jasongilman
jasongilman / atom_clojure_setup.md
Last active May 11, 2024 02:25
This describes how I setup Atom for Clojure Development.

Atom Clojure Setup

This describes how I setup Atom for an ideal Clojure development workflow. This fixes indentation on newlines, handles parentheses, etc. The keybinding settings for enter (in keymap.cson) are important to get proper newlines with indentation at the right level. There are other helpers in init.coffee and keymap.cson that are useful for cutting, copying, pasting, deleting, and indenting Lisp expressions.

Install Atom

Download Atom

The Atom documentation is excellent. It's highly worth reading the flight manual.

@tyrcho
tyrcho / Basics.scala
Last active March 6, 2018 13:10
Scala CheatSheet
//Values and definitions
val x = 5 // constant, evaluated once
def y = 5 // definition (function), evaluated at each call
lazy val z = 5 // constant with lazy evaluation
var v = 5 // variable, only use when really needed
//Control constructs
if (true) 1 else 2 // conditional _expression_, of type Int