Skip to content

Instantly share code, notes, and snippets.

@lborg019
lborg019 / parser.py
Created May 30, 2016 16:13
Boilerplate regular expression parser for python
import re
# file to be read (replace "list.txt" with your file name
infile = open("list.txt", "r")
# file to write to
outfile = open("result.txt", "w")
# traverse the file
for line in infile:
@lborg019
lborg019 / source.cpp
Created October 23, 2016 09:15
libusb steamcontroller (windows)
#include <iostream>
#include <libusb.h>
#include <cassert>
using namespace std;
#define RT 0x000001; //Right Trigger press
#define LT 0x000002; //Left Trigger press
#define RB 0x000004; //Right Bumper
#define LB 0x000008; //Left Bumper
#define Y 0x000010;
@lborg019
lborg019 / .bash_profile
Created April 16, 2017 02:56
bash files
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
@lborg019
lborg019 / switchboxes.rs
Last active June 21, 2017 17:11
Rust switchboxes.
fn main()
{
//switch boxes
let sbox_zero = [[1,0,3,2],
[3,2,1,0],
[0,2,1,3],
[3,1,3,2]];
let sbox_one = [[0,1,2,3],
[2,0,1,3],
@lborg019
lborg019 / bytesplit.rs
Created June 21, 2017 17:14
Rust byte splitting
fn main() {
let byte: u8 = 0b1001_0110;
let mut high: u8 = 0b0000_0000;
let mut low: u8 = 0b0000_0000;
/*
(1 << 0) -> 0000 0001
(1 << 1) -> 0000 0010
(1 << 2) -> 0000 0100
@lborg019
lborg019 / bit_vs_str_permutations.rs
Created June 23, 2017 15:35
Permuting bits using bitshifts can be at least 20 times faster than using String operations (in nanos)
use std::time::{Instant};
fn permute_eight_bits(ten_bit: u16) -> u8
{
// P8[6 3 7 4 8 5 10 9]
// P8[5 2 6 3 7 4 9 8] (-1)
let mut permuted_byte = 0b0000_0000_0000_0000;
let p_eight: [(u16,u16);8] = [(5, 0b0000_0000_0010_0000),
(2, 0b0000_0000_0000_0100),
@lborg019
lborg019 / .hyper.js
Created June 29, 2017 20:17
hyper.js for my windows with git-for-windows-sdk
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 14,
// font family with optional fallbacks
@lborg019
lborg019 / wav-deinterlacer.py
Last active February 15, 2018 23:26
Deinterlace .wav files: $ python2 wav-deinterlacer.py <filename.wav> <samplesize (in bytes)>
import os
import sys
import binascii
from itertools import chain, izip, repeat, islice
# this program is compatible with python 2.7.8
# interspace function
def intersperse(delimiter, seq):
return islice(chain.from_iterable(izip(repeat(delimiter), seq)), 1, None)
@lborg019
lborg019 / README.md
Last active July 1, 2020 20:39 — forked from smileart/README.md
Fine tuning smileart's zsh agnoster theme:

lukezin's .zsh-theme

Improvements to smileart's agnoster theme mod:

  • Replaced special characters in the code (fixed bugged characters, currently works with powerline fonts)
  • Prompt is shorter, shows only the current directory
  • LS Colors match iTerm's Dark Solarized theme

to do:

  • Fix tab completion: tab completion should automatically work on special characters (such as [) right now you have to escape such characters for tab to complete it \[
@lborg019
lborg019 / codevr.Build.cs
Last active November 13, 2020 08:50
Boost library in Unreal
// Fill out your copyright notice in the Description page of Project Settings.
using System;
using System.IO;
using UnrealBuildTool;
public class codevr : ModuleRules
{
public codevr(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;