Skip to content

Instantly share code, notes, and snippets.

View seven1m's full-sized avatar

Tim Morgan seven1m

View GitHub Profile
@mike-bourgeous
mike-bourgeous / popen3_2007.c
Last active December 9, 2024 09:17 — forked from nitrogenlogic/00_popen3_moved.md
Two implementations of a popen3() function in POSIX/C providing stdin, stdout, and stderr (http://blog.mikebourgeous.com/2011/06/12/programmatic-process-control-in-c-popen3/)
/*
* This implementation of popen3() was created in 2007 for an experimental
* mpg123 frontend and is based on a popen2() snippet found online. This
* implementation may behave in unexpected ways if stdin/stdout/stderr have
* been closed or modified. No warranty of its correctness, security, or
* usability is given. My modifications are released into the public domain,
* but if used in an open source application, attribution would be appreciated.
*
* Mike Bourgeous
* https://github.com/mike-bourgeous
@fairlight1337
fairlight1337 / catch_segv.cpp
Last active October 9, 2024 15:01
Catching SIGSEGV (Segmentation Faults) in C
// This code installs a custom signal handler for the SIGSEGV signal
// (segmentation fault) and then purposefully creates a segmentation
// fault. The custom handler `handler` is then entered, which now
// increases the instruction pointer by 1, skipping the current byte
// of the faulty instruction. This is done for as long as the faulty
// instruction is still active; in the below case, that's 2 bytes.
// Note: This is for 64 bit systems. If you prefer 32 bit, change
// `REG_RIP` to `REG_EIP`. I didn't bother putting an appropriate
// `#ifdef` here.
@gligneul
gligneul / mcjit.cpp
Created January 19, 2016 01:49
LLVM MCJIT Code Samples (Working!)
/*
* LLVM 3.5 code sample using MCJit
*
* To compile, execute on terminal:
* clang++ -o mcjit mcjit.cpp `llvm-config --cxxflags --ldflags --libs all --system-libs`
*/
#include <iostream>
#include <memory>
@wvdschel
wvdschel / Promoted_tweet_blocker.user.js
Created August 25, 2015 15:25
Hide promoted tweets greasemonkeyscript
// ==UserScript==
// @name Promoted tweet blocker
// @namespace org.fixnum.tweetblock
// @include https://twitter.com/
// @version 1
// @grant none
// ==/UserScript==
var tweets = document.getElementsByClassName("tweet");
for(tweetIdx = 0; tweetIdx < tweets.length; tweetIdx++) {
@donis
donis / ffmpeg_cut_video
Last active July 31, 2023 13:49
Cut middle out from some video with ffmpeg
# First we cut the video in how many parts we want
# Step 1. cut the first part of the video and cut it to a separate file
ffmpeg.exe -ss 00:00:00.000 -t 00:02:18.00 -i recording-full.flv -c:v copy -c:a copy recording-full-part1.flv
# Step 2. cut the second part from original video
ffmpeg.exe -ss 00:03:47.000 -i recording-full.flv -c:v copy -c:a copy recording-full-part2.flv
# Step 3. create a file with your cut parts to concat into one video with these contents and name it whatever (i.e. videos.txt):
file 'C:\Path\To\recording-full-part1.flv'
@drkarl
drkarl / gist:739a864b3275e901d317
Last active October 30, 2024 19:38
Ask HN: Best Linux server backup system?

Linux Backup Solutions

I've been looking for the best Linux backup system, and also reading lots of HN comments.

Instead of putting pros and cons of every backup system I'll just list some deal-breakers which would disqualify them.

Also I would like that you, the HN community, would add more deal breakers for these or other backup systems if you know some more and at the same time, if you have data to disprove some of the deal-breakers listed here (benchmarks, info about something being true for older releases but is fixed on newer releases), please share it so that I can edit this list accordingly.

  • It has a lot of management overhead and that's a problem if you don't have time for a full time backup administrator.
<?php
// Test
$blaine = new Chain('Person', array(
'firstName' => 'Blaine',
'lastName' => 'Sch',
'city' => 'Tulsa',
'state' => 'Oklahoma',
'zip' => '74107',
));
@choppsv1
choppsv1 / emacs-24.4-24bit.diff
Last active September 14, 2017 16:23
True color (24-bit) terminal support for Emacs 24.4
This diff is a modified version of a diff written by Rüdiger Sonderfeld.
The original diff can be found here:
http://emacs.1067599.n5.nabble.com/RFC-Add-tty-True-Color-support-tt299962.html
To enable the feature one must set one of 2 environment variables either
ITERM_24BIT or KONSOLE_DBUS_SESSION. The former will enable ITU T.416 mode, the
latter will use semi-colon seperators used by other terminals (and also
supported by iterm development branch).
@bensie
bensie / gist:e9b5cd8a16fe1d40210f
Created August 6, 2014 15:35
Install ElasticSearch
sudo apt-get install openjdk-7-jre-headless -y
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.2.2.deb
sudo dpkg -i elasticsearch-1.2.2.deb
sudo service elasticsearch start
@jeremyvdw
jeremyvdw / docker_cleanup
Created July 1, 2014 11:27
Docker: cleans exited containers and unused images
# delete all non-running container
docker ps -a | grep 'Exit' | awk '{print $1}' | xargs docker rm
# delete unused images
docker images | grep '<none>' | awk '{print $3}' | xargs docker rmi