Skip to content

Instantly share code, notes, and snippets.

View rhnvrm's full-sized avatar
🔧
Building things

Rohan Verma rhnvrm

🔧
Building things
View GitHub Profile
@slok
slok / pprof.md
Last active June 18, 2025 14:59
Go pprof cheat sheet

Enable profiling

Default http server

import (
    _ "net/http/pprof"
    "net/http"
)
ex ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
@imjiten
imjiten / rcon.py
Last active December 20, 2024 21:40
GoldSrc Counter Strike Rcon Command Python
# usgae pyhton rcon.py <ip> <password> <command>
import socket
import sys
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.settimeout(3.0)
sock.sendto(b'\xff\xff\xff\xffchallenge rcon', (sys.argv[1], 27015))
response = sock.recvfrom(8196)[0]
response = response.split()
@rhnvrm
rhnvrm / libsoy_build_error.sh
Last active March 1, 2016 23:26
Build error using libsoy on Ubuntu 14.04
rohan@rohan-K53SV:/media/rohan/2534448c-a1f4-4ca8-91d9-47e40de49361/copyleft_games/libsoy$ ./waf configure
Setting top to : /media/rohan/2534448c-a1f4-4ca8-91d9-47e40de49361/copyleft_games/libsoy
Setting out to : /media/rohan/2534448c-a1f4-4ca8-91d9-47e40de49361/copyleft_games/libsoy/build
Checking for 'gcc' (C compiler) : /usr/bin/gcc
Checking for program 'pkg-config' : /usr/bin/pkg-config
Checking for 'gobject-2.0' >= 2.32 : yes
Checking for 'gthread-2.0' >= 2.32 : yes
Checking for program 'valac-0.26' : not found
Checking for program 'valac-0.24' : not found
Checking for program 'valac-0.22' : /usr/bin/valac-0.22
@MichaelKreil
MichaelKreil / ffmpeg4matelight.sh
Last active April 7, 2024 23:22
using ffmpeg to stream videos, gifs, the webcam or the screen to matelight
# Stream a video
ffmpeg -re -i video.avi -vf "scale=40:ih*40/iw, crop=40:16" -f rawvideo -vcodec rawvideo -sws_flags bilinear -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
# Loop a gif
ffmpeg -re -ignore_loop 0 -i image.gif -vf "scale=40:ih*40/iw, crop=40:16" -f rawvideo -vcodec rawvideo -sws_flags bilinear -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
# Stream webcam
# Mac
ffmpeg -re -f avfoundation -r 30 -s 1280x720 -i "0" -vf "scale=40:ih*40/iw, crop=40:16, pp=autolevels:f, eq=1.5" -f rawvideo -vcodec rawvideo -sws_flags bilinear -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
@brock
brock / psql-with-gzip-cheatsheet.sh
Last active May 14, 2025 13:12
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 3, 2025 16:10
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@entaroadun
entaroadun / gist:1653794
Created January 21, 2012 20:10
Recommendation and Ratings Public Data Sets For Machine Learning

Movies Recommendation:

Music Recommendation:

@JeffreyWay
JeffreyWay / gist:1525217
Created December 27, 2011 21:29
Instant Server for Current Directory
alias server='open http://localhost:8000 && python -m SimpleHTTPServer'
@pklaus
pklaus / ping.py
Created March 5, 2011 09:50
A pure python ping implementation using raw socket.
#!/usr/bin/env python2
"""
Other Repositories of python-ping
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* https://github.com/l4m3rx/python-ping supports Python2 and Python3
* https://bitbucket.org/delroth/python-ping