Skip to content

Instantly share code, notes, and snippets.

# Powershell 5.1 version
ls *.wav | % { $file=$_; Get-Content $file.Name -Encoding byte -TotalCount 8 | Select -Last 4 | Foreach-Object {[byte]$a=0} {$a = $a -bor $_} {New-Object PSObject -Property @{status=$(if($a){'size set'}else{'no size set'});file=$file.Name}} }
# Powershell 7.1 version
ls *.wav | % { $file=$_; Get-Content $file.Name -AsByteStream -TotalCount 8 | Select -Last 4 | Foreach-Object {[byte]$a=0} {$a = $a -bor $_} {New-Object PSObject -Property @{status=$(if($a){'size set'}else{'no size set'});file=$file.Name}} }
@sir-ragna
sir-ragna / ipv6_ula_generator.py
Created July 2, 2018 21:15
IPv6 script to generate ULA addresses
#!/usr/bin/python3
"""
Generate a list of IPv6 ALU(Unique Local Addresses).
"""
from ipaddress import IPv6Address
from random import sample
from os import urandom
amount = 100 # amount to generate
@sir-ragna
sir-ragna / usermanagement.sh
Created April 29, 2017 21:04
Remove quasselcore users in SQLite database.
#!/bin/sh
#
# Delete Quasselcore users from your SQLite database
#
exeq()
{
# Execute SQL Query
result=$(sqlite3 "${QUASSELDB}" "${1}")
echo "${result}"
@sir-ragna
sir-ragna / FFMPEG.MD
Last active April 27, 2016 21:02
MAKING WEBM WITH FFMPEG
@sir-ragna
sir-ragna / wrap.js
Created September 28, 2015 20:47
log args
/* A function that give the first argument to the callback function */
function wrapper(func) {
return function(arg1, callback) {
func(arg1, function() {
callback(arg1);
});
};
}
function bar(arg1) {
@sir-ragna
sir-ragna / iptables samba 4
Created May 9, 2015 21:31
iptables config for my samba 4 machine
#!/bin/sh
## Make backup of previous config ##
iptables-save > /root/iptables-works-`date +%F+%H:%M`
# restore with
# `iptables-restore < iptables-dump-2014-04-13`
## Clear IP rules ##
iptables -F
iptables -X
@sir-ragna
sir-ragna / gist:8d83dff322aad4291987
Created February 21, 2015 22:06
git log graph history
git log --all --graph --pretty=format:'%Cred%h%Creset -%C(cyan)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
@sir-ragna
sir-ragna / dropboxd.sh
Created October 29, 2014 18:42
Dropbox control script
#! /bin/bash
## Install dropbox
## `cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -`
## This basically creates a folder `~/.dropbox-dist`
## Initiate `~/.dropbox-dist/dropboxd` and it will ask you some questions the first
## time you run it.
pid=`pidof dropbox`
command=${1:-'start'} # $1 is the first arg
@sir-ragna
sir-ragna / observer.js
Last active December 21, 2015 18:39
Communication between wrapped code JS. Wrapping is nice if you want to use code from other projects, but sometimes that code has to communicate. So I wrote this to check if it would work the way I hoped.
/**
* Further reading:
* Namespaces in JS http://www.dustindiaz.com/namespace-your-javascript/
*/
var observable = (function(){
var observers = [];