Skip to content

Instantly share code, notes, and snippets.

@asimjalis
asimjalis / perl-shell.md
Created December 8, 2012 15:34
How to run Perl in an interactive shell

How to run Perl in an interactive shell

by Asim Jalis, MetaProse.com

An interactive shell is useful for quickly trying out different commands. While Ruby, Python, and Clojure come with interactive shells, Perl does not. However, it is easy to create one using this one-liner on Unix systems:

perl -e 'do{print("perl> ");$_x=<>;chomp $_x;print(eval($_x)."\n")}while($_x ne "q")'
@eqhmcow
eqhmcow / unzip.pl
Last active December 31, 2022 18:49
Perl unzip example with IO::Uncompress::Unzip
#!/usr/bin/perl
# example perl code, but this should now actually work properly, even on
# Windows
# thanks to everyone who tested this, reported bugs and suggested or
# implemented fixes!
# this code is licensed under GPL 2 and/or Artistic license;
# aka free perl software
@fendent
fendent / xbox360hid.h
Created June 4, 2013 21:41
The XBox360 HID descriptor
char ReportDescriptor[196] = {
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x05, // USAGE (Game Pad)
0xa1, 0x01, // COLLECTION (Application)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x3a, // USAGE (Counted Buffer)
0xa1, 0x02, // COLLECTION (Logical)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x02, // REPORT_COUNT (2)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
@damondouglas
damondouglas / gitclone-nonempty.sh
Created January 25, 2014 18:40
Git clone into non-empty directory
git clone --no-checkout git@github.com:<path>.git tmp
mv tmp/.git .
rm -rf tmp
git reset --hard HEAD
@vivien
vivien / irccat
Created May 2, 2014 00:38
irccat - Using netcat with an IRC channel
#!/bin/sh
# Copyright 2014 Vivien Didelot <vivien@didelot.org>
# Licensed under the terms of the GNU GPL v3, or any later version.
NICK=irccat42
SERVER=irc.freenode.net
PORT=6667
CHAN="#irccat"
{
@noromanba
noromanba / twitch-irc-with-weechat.mkd
Last active January 24, 2024 01:17
How to join Twitch IRC w/ WeeChat
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active May 13, 2024 19:45
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@flibitijibibo
flibitijibibo / fnaUpdate.sh
Last active April 5, 2024 06:00
Use this to update a game's FNA installation!
#!/bin/bash
# FNA Update Script
# Written by Ethan "flibitijibibo" Lee
#
# Released under public domain.
# No warranty implied; use at your own risk.
#
# Run this script in the game's executable folder.
#
# This script requires the following programs:
//gcc osvrexample.c -losvrClientKit
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <osvr/ClientKit/ContextC.h>
#include <osvr/ClientKit/InterfaceC.h>
#include <osvr/ClientKit/InterfaceStateC.h>
@flibitijibibo
flibitijibibo / stardewFNA.sh
Last active February 27, 2024 04:35
Script for converting Stardew Valley for Windows (XNA) to Linux/macOS-compatible (FNA)
#!/bin/bash
# Stardew Valley XnaToFna Automation Script
# Written by Ethan "flibitijibibo" Lee
#
# Usage: Place in Stardew Valley folder, run from terminal.
# NOTE: Be sure you have Mono 4.4 or newer! Stardew's XML structures need it!
# Be smart. Be safe.
set -e