Skip to content

Instantly share code, notes, and snippets.

View FreeSlave's full-sized avatar

Roman Chistokhodov FreeSlave

View GitHub Profile
@FreeSlave
FreeSlave / droprst.sh
Created January 24, 2018 16:21
Dropping RST packages for https
iptables -I INPUT -p tcp --sport 443 --tcp-flags RST RST -j DROP
@FreeSlave
FreeSlave / libscripts.sh
Last active December 31, 2023 05:24
Various aliases to deal with shared libraries
# get first level dependencies (without dependencies of dependencies)
depends() {
many=0; [ "$#" -gt 1 ] && many=1
while [[ "$#" -gt 0 ]]; do
if [ "$many" == 1 ]; then
echo -e "\n$1 depends on:"
fi
objdump -p "$1" | grep NEEDED | tr -s ' ' | cut -d ' ' -f 3
shift
done
@FreeSlave
FreeSlave / makegameicon.py
Last active December 13, 2017 16:06
Python PIL script to generate tga from ico
#!/usr/bin/python
import sys
import os.path
from PIL import Image
loadpath = 'game.ico'
if len(sys.argv) > 1:
loadpath = sys.argv[1]
savepath = os.path.splitext(loadpath)[0] + '.tga'
if len(sys.argv) > 2:
@FreeSlave
FreeSlave / Dockerfile
Last active September 17, 2017 00:04
Festengine in docker
FROM debian:jessie
RUN apt-get update && apt-get install binutils git python-pip python2.7-dev python-wxgtk3.0-dev libvlc-dev libvlccore-dev --no-install-recommends -y
RUN pip2 install pyinstaller
RUN git clone --recursive https://github.com/Himura2la/FestEngine
WORKDIR /FestEngine
RUN (cd etc/python-vlc && python setup.py install)
RUN pyinstaller src/main.pyw
RUN mkdir -p FestEngine.AppDir/usr/share/applications FestEngine.AppDir/usr/bin FestEngine.AppDir/usr/lib FestEngine.AppDir/opt/festengine
RUN printf "[Desktop Entry]\nType=Applicaiton\nExec=festengine\nName=FestEngine\nIcon=festengine" > FestEngine.AppDir/usr/share/applications/festengine.desktop
RUN printf "" > FestEngine.AppDir/festengine.png
@FreeSlave
FreeSlave / Dockerfile
Created September 11, 2017 19:29
Qt 5.9 static build in docker for Linux
FROM ubuntu:trusty
RUN apt-get update
RUN apt-get install -y --no-install-recommends python \
libx11-dev libxfixes-dev libxi-dev \
libxcb1-dev libx11-xcb-dev libxcb-glx0-dev \
libdbus-1-dev libxkbcommon-dev libxkbcommon-x11-dev \
binutils g++ make zlib1g-dev libssl-dev \
libgl1-mesa-dev xz-utils
ENV QT_MAJOR 5
@FreeSlave
FreeSlave / deintr.d
Last active June 22, 2017 11:25
EINTR test
import core.sys.posix.unistd;
import core.sys.posix.sys.types;
import core.sys.posix.sys.stat;
import core.sys.posix.sys.wait;
import core.sys.posix.fcntl;
import core.sys.posix.signal;
import core.stdc.stdio;
import core.stdc.string;
import core.stdc.stdlib;
@FreeSlave
FreeSlave / pixacadem.sh
Last active June 18, 2017 22:21
Upload image to pix.academ from command line and get link
#!/bin/sh
curl --silent --form "image=@$1" --form "action=upload_image" http://pix.academ.info/ | sed -rn "s/^.*image link: \"(.*)\".*/\1/p" | xclip -selection clipboard -t text/plain
@FreeSlave
FreeSlave / generate_common_textures.sh
Created December 20, 2016 13:43
Generate quake3 common textures with imagemagick
#!/bin/sh
gen_texture()
{
name=$1
color1=$2
color2=$3
textcolor=$4
text=$(echo -n "$name" | tr '[:lower:]' '[:upper:]')
convert -size 64x64 xc:"$color2" -fill "$color1" -draw "rectangle 0,0 32,32" -draw "rectangle 32,32 64,64" \
@FreeSlave
FreeSlave / nginx.conf
Last active February 20, 2025 21:07
FastDL nginx configuration for half-life server
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@FreeSlave
FreeSlave / 40_freebsd
Created September 6, 2016 19:01
FreeBSD grub entry for debian
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'FreeBSD' {
insmod ufs2
insmod bsd
search --fs-uuid --no-floppy --set=root *use blkid to get device UUID and insert here*