Skip to content

Instantly share code, notes, and snippets.

View crosstyan's full-sized avatar

Crosstyan crosstyan

View GitHub Profile
@maglietti
maglietti / gistColaboration.md
Created August 21, 2015 16:33
How to collaborate on a gist

To colaborate on a gist:

  1. Clone your gist repo locally
  2. Add your friend’s fork as a remote e.g. if your friend is named Cindy: git remote add-url cindy https://gist.github.com/cindy/df03bdacaef75a80f310
  3. Fetch your friend’s commits: git fetch cindy/master
  4. Merge your friend’s changes into your repo: git merge cindy/master
  5. Push the changes back to GitHub: git push origin/master

Languages have various allowances for white-space. This is a short exploration of parsers I found and what they claim to accept

Key

Oct  Dec Char  Hex  Key Esc
\000   0  NUL  \x00  ^@ \0 (Null byte)
\010   8   BS  \x08  ^H \b (Backspace)
\011   9   HT  \x09  ^I \t (Horizontal tab)
\012  10   LF  \x0A  ^J \n (Line feed)  (Default UNIX NL)
@andrewrk
andrewrk / gist:b09e2024177692fcc08e
Last active August 10, 2022 03:58
introducing the zig programming language https://github.com/andrewrk/zig
You appear to be advocating a new:
[ ] functional [x] imperative [ ] object-oriented [x] procedural [ ] stack-based
[ ] "multi-paradigm" [ ] lazy [ ] eager [x] statically-typed [ ] dynamically-typed
[ ] pure [x] impure [ ] non-hygienic [ ] visual [ ] beginner-friendly
[ ] non-programmer-friendly [ ] completely incomprehensible
programming language. Your language will not work. Here is why it will not work.
You appear to believe that:
[ ] Syntax is what makes programming difficult
[ ] Garbage collection is free [ ] Computers have infinite memory
@windoze
windoze / rx-asio.hpp
Created December 19, 2015 14:06
Boost.ASIO scheduler for RxCPP
#include "rxcpp/rx-scheduler.hpp"
// TODO: C++17 Networking TS
#ifdef WITHOUT_BOOST
// Standalone ASIO
#include <asio.hpp>
namespace asio_ns=::asio
namespace system_ns=::std
#else
// Boost.ASIO
@kalaksi
kalaksi / rsync-rootfs.md
Last active August 26, 2025 20:26
Copy the whole root filesystem excluding pseudo-filesystems and mountpoints

Copying the whole linux root filesystem locally or remotely using rsync

Explanation of chosen options:

  • Verbose output with speed and progress information
  • Try to preserve all possible information: file attrs, hardlinks, ACLs and extended attrs,
  • Exclude contents of pseudo-filesystems and mountpoints
  • In this example source host is remote and destination local.
rsync --info=progress2  -vaHAX --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} source.host:/ /local/destination
@meshell
meshell / CppUG_RAII_main.cpp
Last active February 8, 2025 07:12
RAII example using unique_ptr
#include <cstdio>
#include <cstdlib>
#include <memory>
int main()
{
auto file_open = [](const char* filename, const char* mode) -> FILE*
{
return std::fopen(filename, mode);
};
@kapb14
kapb14 / iptables rule with comments + DNAT rule function
Created February 29, 2016 13:15
Add Comments to iptables Rules + Bash Function to add DNAT rule with comment
Add Comments to iptables Rules:
Depending on your distribution, you may need to load the 'ipt_comment' or 'xt_comment' modules into your running kernel first.
like: 'modprobe ipt_comment'
EXAMPLE:
iptables -A INPUT -j DROP -p tcp --dport 22222 -m comment --comment "test iptables rule comment"
@a5ync
a5ync / InstallNodeAppAsWindowsService.ps1
Created April 20, 2016 01:04
Powershell wrapper over NSSM (Non-Sucking Service Manager), to install Node app as a Windows-Service
#please read the NSSM https://nssm.cc/usage
Function Install-Service {
param(
[Parameter(Mandatory=$true)][string]$NSSMPath,
[Parameter(Mandatory=$true)][string]$serviceName ,
[Parameter(Mandatory=$true)][string]$serviceExecutable ,
[Parameter(Mandatory=$false)][string]$serviceExecutableArgs ,
[Parameter(Mandatory=$false)][string]$serviceAppDirectory ,
[Parameter(Mandatory=$true)][string]$serviceErrorLogFile ,
[Parameter(Mandatory=$true)][string]$serviceOutputLogFile ,
@daredude
daredude / docker-clear.bat
Created June 5, 2016 10:53
delete all docker container and images on windows
@echo off
FOR /f "tokens=*" %%i IN ('docker ps -aq') DO docker rm %%i
FOR /f "tokens=*" %%i IN ('docker images --format "{{.ID}}"') DO docker rmi %%i
@nebgnahz
nebgnahz / gstreamer.md
Last active January 9, 2025 13:12
Collections of GStreamer usages

Most GStreamer examples found online are either for Linux or for gstreamer 0.10.

This particular release note seems to have covered important changes, such as:

  • ffmpegcolorspace => videoconvert
  • ffmpeg => libav

Applying -v will print out useful information. And most importantly the negotiation results.