Skip to content

Instantly share code, notes, and snippets.

View hamdouni's full-sized avatar

Brahim Hamdouni hamdouni

View GitHub Profile
@hamdouni
hamdouni / Golang-http-no-redirect.go
Last active August 29, 2015 14:06
Golang http get without following redirection
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
func main() {
@hamdouni
hamdouni / utf8-to-latin1.r
Last active August 29, 2015 14:11
Rebol Convert UTF8 to LATIN1 (ISO8859-1)
rebol []
decode: func [
{
Decode a UTF-8 encoded string into latin1.
Adapted from http://www.rebol.org/view-script.r?script=utf-8.r
}
xs [string!]
/local m x c result [string!]
][
#!/bin/sh
a1="◐"
a2="◒"
a3="◑"
a4="◓"
i=1
while true
do
@hamdouni
hamdouni / settings.json
Created May 22, 2016 21:50
VSCODE USER PREFERENCE
{
"go.formatOnSave": true,
"go.formatTool": "goimports"
}
@hamdouni
hamdouni / docker-less-cpu.sh
Last active October 13, 2017 10:53
Lunch a docker container with less cpu ressource (simulate slow machine)
# Example with a mysql container running at 10% cpu
docker run --cpu-quota=10000 --name esc-db -d --volumes-from dbdata -p 127.0.0.1:3306:3306 -v $(pwd)/data:/data softinnov/esc-db
@hamdouni
hamdouni / printDate.java
Created October 11, 2017 08:27
Print a date in java
import java.util.Date;
public class printDate {
public static void main(String[] args) {
Date d = new Date();
System.out.println(d);
}
}
@hamdouni
hamdouni / AlpineLinuxGraphicVirtualbox.sh
Last active May 12, 2023 09:52
Alpine Linux Graphic in Virtualbox
apk update
apk add udev xorg-server xf86-input-evdev xf86-video-vesa setxkbmap
apk add build-base git libcurl libxft-dev libx11-dev libxinerama-dev lxterminal
apk add ca-certificates wget
update-ca-certificates
rc-update add udev sysinit
rc-update add udev-postmount default
git clone https://github.com/hamdouni/myDwm
cd myDwm/programs/dwm-6.0
make && make install
workspace:
base: /go
pipeline:
backend:
image: golang
commands:
- go get -t ./...
- go test
- go build
@hamdouni
hamdouni / set_other_monitor_above.sh
Last active September 24, 2018 07:10
Get the other connected monitor (not the internal) and configure it above
#!/bin/sh
# get the other connected monitor (not the internal)
other=`xrandr |grep " connected" | awk '{print $1}' | grep -v 'eDP-1\|^$i'`
xrandr --output eDP-1 --auto --below $other --output $other --auto
@hamdouni
hamdouni / docker-strace.md
Created October 9, 2018 10:34
How to use strace inside a docker container

Dockerfile

FROM debian:stretch-slim
RUN apt update
RUN apt install strace

docker-compose.yml

version: '3'