Skip to content

Instantly share code, notes, and snippets.

View AdrianKoshka's full-sized avatar
🦉
Focusing

Adrian Lucrèce Céleste AdrianKoshka

🦉
Focusing
View GitHub Profile
import os, random, string, sys, urllib2
num_pics = 1
if len(sys.argv) > 1:
num_pics = int(sys.argv[1])
while num_pics > 0:
name = ''.join(random.sample(string.letters+string.digits, 5)) + '.jpg'
img = urllib2.urlopen("http://i.imgur.com/" + name).read()
if len(img) != 503: # 'image not found' is 503 bytes
#!/bin/sh
# Set $PUUSH_API_KEY to your key and export it.
# The key is found on <http://puush.me/account/settings>.
if [ -z "$PUUSH_API_KEY" ]; then
echo "puu: please export api key" 1>&2
exit 1
fi
for file in "$@"; do
@cfilipov
cfilipov / SwiftGenericTrie.md
Last active July 21, 2016 00:49
Generic-Key Trie in Swift

Generic Trie in Swift

This is an attempt to implement a trie in Swift with a generic key. Instead of using just strings as keys, this trie can be keyed by any object that can generate its own prefixes. This is accomplished by using a protocol to define a trie key that can return a generator of Hashables. We need Hashables because the prefixes will be stored in a Dictionary.

Defining the Key Type

The TrieNode class will be a private implementation detail. It helps to separate the implementation into TrieNode and the wrapper for a few reasons:

  1. If we want to extend the trie to implement some common Swift collection protocols, many of those don't make sense for every node.
  2. We want references for nodes but the wrapper struct can help us simulate value semantics.
#!ipxe
kernel http://example.com/linux initrd=initrd.gz auto url=http://example.com/preseed.cfg
initrd http://example.com/initrd.gz
boot
#!/bin/bash
# Nmap can crash when scanning large ranges
# To use this script, start your scan with whatever
# nmap options you want making sure you use -oA <filename>
# or -oG <filename> (you need the gnmap file) then cancel
# the scan. replace <filename> below and run this script.
# It will also record when it failed to a file called failed.txt
until nmap --resume <filename>.gnmap
@KittyKatt
KittyKatt / pomf
Last active March 24, 2018 14:49
pomf.se BASH script to upload images
#!/usr/bin/env bash
# pomf.se uploader
# requires: curl
dest_url='http://pomf.se/upload.php'
return_url='http://a.pomf.se'
if [[ -n "${1}" ]]; then
file="${1}"
if [ -f "${file}" ]; then
@dfinke
dfinke / Get-YouTubeLinkAndThumbnail.ps1
Last active August 27, 2018 07:57
Generate the YouTube html for an image with a link to the video
function Get-YouTubeLinkAndThumbnail {
param(
[Parameter(Mandatory)]
$YouTubeVideoID,
$Width=240,
$Height=180,
$ImageAltText='IMAGE ALT TEXT HERE',
[Switch]$DontCopyToClipboard
)
@bitjockey42
bitjockey42 / Ubuntu 16.04 systemd-boot.md
Last active September 25, 2019 10:07
Ubuntu 16.04 using systemd-boot instead of grubby

You do not need a separate /boot partition unless you have an LVM setup (used in dm-crypt setups).

Run ubiquity -b to open the installer with the option of skipping grub installation (since we're using systemd-boot).

When you get to the screen "Ubuntu has finished installation" choose Continue testing.

Open a Terminal.

Chroot into the new system.

@acepace
acepace / rol.im-securegoldenkeyboot
Last active March 25, 2021 00:29
Secure Golden Key Boot: (MS16-094 / CVE-2016-3287 and MS16-100/ CVE-2016-332)
| |
| a w r i t e u p r e l e a s e b y r o l |
| ________ ___ ________ ________ |
| <_ __ \/ \/ \/ ____ \ |
| T T<___/\___/\_ /\ _/\ \__j _/ |
| | | T T T / \ T__\____ T |
| | | | | | \ / |T T T | |
| l__j_____l___j_l__><__j| | | | |
| T _______ T | ___j | l___j | |
| | T __T |_j l_______l________j |
@Rurik
Rurik / parse_procmon_filters.py
Last active December 5, 2021 16:55
Quick tool to find and extract filters from Procmon configuration files
# Procmon Rule Parser v0.02
# Brian Baskin - @bbaskin
# Reads default rules from an exported Procmon Configuration (.PMC) or Procmon Filter (.PMF) file
# Example output:
"""
12:09:59-bbaskin@~/Development/Noriben$ python parse_procmon_filters.py -f ProcmonConfiguration.pmc
[Exclude] Process Name is Procmon64.exe
[Exclude] Operation is QueryStandardInformationFile
[Exclude] Operation is RegOpenKey
[Exclude] Operation is NotifyChangeDirectory