Skip to content

Instantly share code, notes, and snippets.

View SOF3's full-sized avatar
🚂
Watching the model train

Jonathan Chan Kwan Yin SOF3

🚂
Watching the model train
View GitHub Profile
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@rxaviers
rxaviers / gist:7360908
Last active May 31, 2024 14:32
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@magnetikonline
magnetikonline / Dockerfile
Last active August 14, 2023 19:23
Dockerfile Ubuntu apt-get AU mirror switching.
FROM ubuntu:18.04
LABEL maintainer="Peter Mescalchin <peter@magnetikonline.com>"
RUN sed --in-place --regexp-extended "s/(\/\/)(archive\.ubuntu)/\1au.\2/" /etc/apt/sources.list && \
apt-get update && apt-get upgrade --yes
@brandon15811
brandon15811 / dns_server.sh
Created December 13, 2014 03:26
Very basic DNS server written in bash
#!/bin/bash
#Based off of http://code.activestate.com/recipes/491264/
if [ "$1" == "startserver" ]; then
ncat -u -l 5355 -c $(readlink -f $0) -k
exit
fi
timeout 1s cat /dev/stdin > input
req=$(cat input | xxd -p)
#Functions from http://ubuntuforums.org/showthread.php?t=735140&p=4584216#post4584216
@Thinkscape
Thinkscape / flattenExceptionBacktrace.php
Last active December 28, 2023 12:28
Make any PHP Exception serializable by flattening complex values in backtrace.
<?php
function flattenExceptionBacktrace(\Exception $exception) {
$traceProperty = (new \ReflectionClass('Exception'))->getProperty('trace');
$traceProperty->setAccessible(true);
$flatten = function(&$value, $key) {
if ($value instanceof \Closure) {
$closureReflection = new \ReflectionFunction($value);
$value = sprintf(
'(Closure at %s:%s)',
@zwzmzd
zwzmzd / Sphere.cpp
Last active November 21, 2022 09:22
[OpenGL] An example to draw a sphere with vao and vbo
#include "sphere.h"
#include <vector>
#include <iostream>
#include <glm/gtc/matrix_inverse.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtx/string_cast.hpp>
Sphere::Sphere()
{
@graste
graste / strace.md
Last active May 31, 2024 09:06
strace process for network and memory and other syscalls

File activity

strace -e trace=file -fp PID (file) or strace -e trace=desc -fp PID (file descriptors)

Common calls:

  • access
  • close – close file handle
  • fchmod – change file permissions
  • fchown – change file ownership
@shoghicp
shoghicp / run.php
Last active September 26, 2020 10:33
Header Extractor - Usage: php run.php --input libminecraftpe.so --output headers/ --pointer-size 4 --asm
<?php
/**
* Minecraft: Pocket Edition header extractor
*
* This tool needs objdump (and objdump-multiarch + arm variants) installed on the current system
*
*/
const VERSION = "0.0.1";
@NiclasOlofsson
NiclasOlofsson / commands.js
Created September 20, 2016 17:01
MCPE Commands JSON
2016-09-20 18:59:59,577 DEBUG MiNET.Client.MiNetClient - Command JSON:
{
"ability": {
"versions": [
{
"description": "commands.ability.description",
"overloads": {
"default": {
"input": {
"parameters": [
@kalimatas
kalimatas / PushVsMerge.php
Last active May 26, 2020 13:02
PHPBench array_push vs array_merge
<?php
declare(strict_types = 1);
use PhpBench\Benchmark\Metadata\Annotations\BeforeMethods;
use PhpBench\Benchmark\Metadata\Annotations\Revs;
require 'vendor/autoload.php';
/**