Skip to content

Instantly share code, notes, and snippets.

@alepez
alepez / u-boot-usb.txt
Last active May 4, 2022 13:19
u-boot boot linux from usb
env set bootcmd_usb "run findfdt; usb start; if run loadimage_usb; then run usbboot; fi"
env set loadfdt_usb "fatload usb ${usbdev}:${usbpart} ${fdt_addr} ${fdt_file}"
env set loadimage_usb "fatload usb ${usbdev}:${usbpart} ${loadaddr} ${image}"
env set usbargs "setenv bootargs console=${console},${baudrate} root=${usbroot}"
env set usbboot "echo Booting from usb ...; run usbargs; if run loadfdt_usb; then bootz ${loadaddr} - ${fdt_addr}; else echo WARN: Cannot load the DT; fi"
env set usbdev 0
env set usbpart 1
env set usbroot "/dev/sda2 rootwait rw"
run bootcmd_usb
@dankrause
dankrause / ipc.py
Last active September 10, 2024 19:57
Simple socket IPC in python
# Copyright 2017 Dan Krause
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@emonti
emonti / make_xpwn_dylib.sh
Created January 10, 2014 09:51
quick/dirty build a dynamic lib from xpwn - eric monti WARNING: this was for something really specific -- YMMV... drop this in your top-level directory where you checked out planetbeing/xpwn and cross your fingers ;)
#!/bin/bash
# quick/dirty build a dynamic lib from xpwn - eric monti
# WARNING: this was for something really specific -- YMMV...
# drop this in your top-level directory where you checked out planetbeing/xpwn and cross your fingers ;)
cmake -f CMakeLists.txt
make || exit 1
rm -rf ./sharedlib
mkdir -p ./sharedlib/lib
@hurie
hurie / setlocal.php
Last active March 13, 2024 05:52
Set locale for Indonesian on all platform (Windows, Linux and others Nix server)credit for buana95 at yahoo dot com
<?php
setlocale(LC_ALL,
'id_ID.UTF8', 'id_ID.UTF-8', 'id_ID.8859-1', 'id_ID',
'IND.UTF8', 'IND.UTF-8', 'IND.8859-1', 'IND',
'Indonesian.UTF8', 'Indonesian.UTF-8', 'Indonesian.8859-1', 'Indonesian', 'Indonesia',
'id', 'ID',
// Add english as default (if all Indonesian not available)
'en_US.UTF8', 'en_US.UTF-8', 'en_US.8859-1', 'en_US', 'American', 'ENG', 'English',
);
@AndersDJohnson
AndersDJohnson / abs_dirname.sh
Last active June 5, 2019 13:33
bash script BASEDIR
# from: https://github.com/zimbatm/direnv/blob/3bb35d375331fca89614f0015b2a6cd21688ab79/bin/direnv
# usage: abs_dirname $filename
# finds the original $filename path and prints it's absolute folder path
abs_dirname() {
prev_path="$1"
# Resolve the symlink(s) recursively
while true; do
abs_path=`readlink "$prev_path"`
if [ -z "$abs_path" ]; then
abs_path="$prev_path"
@marcelom
marcelom / pysyslog.py
Created December 5, 2012 18:06
Tiny Python Syslog Server
#!/usr/bin/env python
## Tiny Syslog Server in Python.
##
## This is a tiny syslog server that is able to receive UDP based syslog
## entries on a specified port and save them to a file.
## That's it... it does nothing else...
## There are a few configuration parameters.
LOG_FILE = 'youlogfile.log'