Skip to content

Instantly share code, notes, and snippets.

View Ionizing's full-sized avatar
😵
Being defeated by DALAOs

Ionizing Ionizing

😵
Being defeated by DALAOs
  • Mars
View GitHub Profile
@stephenhardy
stephenhardy / git-clearHistory
Created April 26, 2013 22:14
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@tsl0922
tsl0922 / .tmux.conf
Last active July 1, 2024 17:16
vim style tmux config
# vim style tmux config
# use C-a, since it's on the home row and easier to hit than C-b
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix
set -g base-index 1
# Easy config reload
bind-key R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
@Jackarain
Jackarain / gist:ecc6594ef6930db7fa7f
Created March 23, 2015 04:50
Linking libstdc++ statically
Linking libstdc++ statically
Christopher Baus writes about his problems linking libstdc++ statically. Yes, making C++ binaries that will work properly in different Linux distributions is somewhat painful. The problem is not so much linking libstdc++ statically – it is just a library, after all – but the runtime support required by C++ code in general, to enable features like RTTI and exception handling.
The runtime support code used by different parts of a C++ application needs to be compatible. If one part of the program needs to dynamic_cast or catch objects provided by another, both parts must agree on certain implementation details: how to find vtables, how to unwind the stack, and so on.
For C++ and a few other GCC-supported languages with similar features, such details are specified by a C++ ABI. Whenever the ABI used by GCC changes you'll end up with incompatible libraries produced by the different GCC versions. The same is true for plain C, but the C ABI is much simpler and has been around a lot lon
@xavierskip
xavierskip / snake.py
Last active February 24, 2023 12:21
snake in terminal
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import curses
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN
import time
import random
class Snake():
def __init__(self,length,screen):
# left top coordinate (y,x)
@JonathonReinhart
JonathonReinhart / SConstruct
Last active January 6, 2024 06:42
mkdir -p implemented in C
env = Environment(
CCFLAGS = ['-Wall', '-Werror'],
)
env.Program('mkdir_p_test', ['mkdir_p.c', 'test.c'])
@gunjanpatel
gunjanpatel / revert-a-commit.md
Last active July 5, 2024 06:54
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@Liam0205
Liam0205 / example.tex
Last active April 15, 2024 05:30
widetext.sty
\documentclass[twocolumn]{article}
\usepackage{mwe}
\usepackage{widetext}
\begin{document}
\blindtext
\begin{widetext}
\[
E = mc^2.
\]
\end{widetext}
@jamesmacwhite
jamesmacwhite / Workarounds for Netflix and the blocking of IPv6 tunnels.md
Last active June 24, 2024 20:05
Prevent proxy/VPN streaming error messages from Netflix when using a Hurricane Electric IPv6 tunnel.

Workarounds for Netflix and the blocking of Hurricane Electric IPv6 tunnels

The dreaded "You seem to be using an unblocker or proxy." error message. Cool story bro.

This gist was essentially created out of my own rant about Netflix being hostile to IPv6 tunnel services since June 2016. You are welcome to read my opinion on the matter, this is the more technical side to the issue and how to combat it within your own network.

Since I wrote this, various GitHub users have contributed their thoughts and ideas which has been incorporated into this gist. Thank you to everyone who have contributed their own methods and implementations.

The problem

Netflix now treats IPv6 tunnel brokers (such as Hurricane Electric) as proxy servers. A while ago it became apparent to users and Netflix that somewhat by accident, IPv6 tunnel users were being served content outside of their geolocation because of the way Netflix was identifyi

@FrancisMurillo
FrancisMurillo / meow.el
Created January 12, 2017 07:38
Literate Org Haskell
(defconst fn/haskell-file-extension ".hs"
"The de facto haskell file extension.")
(defun fn/add-haskell-file-extension (name)
"Add the extension of .hs to a file or buffer NAME."
(if (string/ends-with name fn/haskell-file-extension)
name (concat name fn/haskell-file-extension)))
(defvar fn/org-haskell-mode-hook nil
"Hook when buffer is haskellized.")
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[domain = 0:2.2, smooth, variable=\x, blue, samples = 221]
plot ({\x}, {sqrt(\x)})
node[anchor = west] {$ y = \sqrt x $};
\end{tikzpicture}
\end{document}