Skip to content

Instantly share code, notes, and snippets.

@fduran
fduran / Linux Bash generate a number of files of random sizes in a range
Last active May 21, 2024 12:42
Linux Bash generate a number of files of random sizes in a range
#!/bin/bash
# generate a number of files with random sizes in a range
min=1 # min size (MB)
max=10 # max size (MB)
nofiles=20 # number of files
for i in `eval echo {1..$nofiles}`
do
dd bs=1M count=$(($RANDOM%max + $min)) if=/dev/urandom of=./files/file$i
@fnuecke
fnuecke / bios.lua
Created December 24, 2014 00:35
Primitive remote code execution via OC network
local m=component.proxy(component.list("modem")())
m.open(2412)
local function respond(...)
local args=table.pack(...)
pcall(function() m.broadcast(2412, table.unpack(args)) end)
end
local function receive()
while true do
local evt,_,_,_,_,cmd=computer.pullSignal()
if evt=="modem_message" then return load(cmd) end
@kuznero
kuznero / nixos-install.md
Last active June 21, 2023 22:34
Installing NixOS behind corporate proxy

In order to install NixOS behind corporate proxy do the usual stuff but before running nixos-install set this environment variable:

export CURL_NIX_FLAGS="-x http://user:password@proxy:port/"

In addition in case you have ties to cloning from GitHub (like vim plugins), you should export proxy related variables:

export HTTP_PROXY=http://user:password@proxy:port/
@ajeetraina
ajeetraina / docker-compose.yml
Created March 7, 2017 08:55
Docker Compose v3.1 file for Secret Management under Docker 1.13
version: "3.1"
services:
db:
image: "mysql:latest"
networks:
collabnet:
aliases: ["db"]
volumes:
- "db_data:/var/lib/mysql"
secrets:
@adisbladis
adisbladis / podman-shell.nix
Last active May 12, 2024 09:21
Use podman within a nix-shell
{ pkgs ? import <nixpkgs> {} }:
let
# To use this shell.nix on NixOS your user needs to be configured as such:
# users.extraUsers.adisbladis = {
# subUidRanges = [{ startUid = 100000; count = 65536; }];
# subGidRanges = [{ startGid = 100000; count = 65536; }];
# };
@guisehn
guisehn / multiple-files-remove-prefix.md
Created February 4, 2020 20:28
Remove prefix from multiple files in Linux console

Bash

for file in prefix*; do mv "$file" "${file#prefix}"; done;

The for loop iterates over all files with the prefix. The do removes from all those files iterated over the prefix.

Here is an example to remove "bla_" form the following files:

bla_1.txt
bla_2.txt
@wedaly
wedaly / server.bu
Created May 8, 2023 13:44
Fedora CoreOS butane file for k3s server
variant: fcos
version: 1.4.0
passwd:
users:
- name: testuser
groups: ["wheel", "sudo"]
#ssh_authorized_keys:
# - <your SSH public key>
systemd:
units: