Skip to content

Instantly share code, notes, and snippets.

@mewmew
mewmew / goclean.sh
Last active April 22, 2021 22:32 — forked from h12w/goclean.sh
#!/bin/bash
# The script does automatic checking on a Go package and its sub-packages, including:
# 1. gofmt (http://golang.org/cmd/gofmt/)
# 2. goimports (http://godoc.org/golang.org/x/tools/cmd/goimports)
# 3. golint (https://github.com/golang/lint)
# 4. go vet (http://golang.org/cmd/vet)
# 5. race detector (http://blog.golang.org/race-detector)
# 6. test coverage (http://blog.golang.org/cover)
package main
import (
"image"
"image/color"
"log"
"github.com/mewkiz/pkg/imgutil"
)
@mewmew
mewmew / bindsh.c
Last active August 29, 2015 14:09
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <arpa/inet.h>
int main(int argc, char **argv) {
int lsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if(lsock == -1) {
fprintf(stderr, "socket() failed.\n");
@mewmew
mewmew / nested.go
Created April 18, 2015 20:00
Generate C programs for stress testing.
// nested is a tool which generates C programs with a given number of nested if-
// statements. These programs are intended to stress test the implementations of
// various decompilation components and give an approximation of their time
// complexity.
//
// Example output for n=2:
//
// int main(int argc, char **argv) {
// int x = 0;
// if (x < 1) {
@mewmew
mewmew / arch-linux-install.sh
Last active May 9, 2018 15:57 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@mewmew
mewmew / crawl.go
Last active August 9, 2016 01:20
Identify broken links based on GitHub directory listing.
// Based on https://github.com/PuerkitoBio/gocrawl/blob/master/examples_test.go
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
@mewmew
mewmew / flavor.rb
Created November 15, 2016 09:31 — forked from ttscoff/flavor.rb
Quick wrapper to convert Markdown to HTML via Github API
#!/usr/bin/ruby
# Convert a Markdown README to HTML with Github Flavored Markdown
# Github and Pygments styles are included in the output
#
# Requirements: json gem (`gem install json`)
#
# Input: STDIN or filename
# Output: STDOUT
# Arguments: "-c" to copy to clipboard (or "| pbcopy"), or "> filename.html" to output to a file
# cat README.md | flavor > README.html
digraph {
rankdir=LR
{rank=same; binary unpacker upx}
nodesep=0.5
/* input and output formats */
"Mach-O Universal static library" [fillcolor=limegreen style=filled]
archive [fillcolor=limegreen style=filled]
elf [fillcolor=limegreen style=filled]
pe [fillcolor=limegreen style=filled]
@mewmew
mewmew / PKGBUILD
Created January 21, 2018 17:03
AUR PKGBUILD for PhysicsFS with MPQ files support.
pkgname=physfs-git
pkgver=12
pkgrel=1
pkgdesc="A library to provide abstract access to various archives"
arch=('x86_64')
url="https://github.com/dgengin/physfs"
license=('ZLIB')
depends=('zlib')
makedepends=('git' 'cmake' 'doxygen')
provides=("physfs")
@mewmew
mewmew / web-servers.md
Created February 15, 2018 13:06 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000