Skip to content

Instantly share code, notes, and snippets.

View blahgeek's full-sized avatar
👨‍💻

Yikai Zhao blahgeek

👨‍💻
View GitHub Profile
/// @file main.cpp @version 1.0 @date 04/04/2013
/// @author BlahGeek@Gmail.com
#include <cstdlib>
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <cmath>
#include <fstream>
#include <cstring>
@blahgeek
blahgeek / isatap.fish
Created September 17, 2013 10:43
ISATAP config for Mac OS X. Works either with or without NAT. (fish script)
#!/usr/loca/bin/fish
function isatap
set REMOTE_IP 166.111.21.1
set LINK_PREFIX "fe80::200:5efe"
set GLOBAL_PREFIX "2402:f000:1:1501:200:5efe"
if sudo ifconfig gif0 destroy
echo "Previous gif0 destroyed"
end
@blahgeek
blahgeek / default.latex
Created September 18, 2013 04:56
Latex template for pandoc
\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$]{$documentclass$}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[utf8]{inputenc}
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by i@BlahGeek.com at 2014-01-01
def pi_generate():
"""
returns a single digit of pi each time iterated
"""
q, r, t, k, m, x = 1, 0, 1, 1, 3, 3
while True:
Mac OS X 2L~ATTR**com.apple.metadata:kMDItemIsScreenCapture23,com.apple.metadata:kMDItemScreenCaptureTypeecom.apple.quarantinebplist00 bplist00Yselectioq/0042;52d0b1c6;Preview;
$ curl -v -6 https://www.google.com
* Rebuilt URL to: https://www.google.com/
* Hostname was NOT found in DNS cache
* Trying 2404:6800:4005:804::1011...
* Connected to www.google.com (2404:6800:4005:804::1011) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: none
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
@blahgeek
blahgeek / quine-with-comments.bf
Last active September 12, 2022 08:30
Brainfuck quine
# Run `cat quine.bf | sed 's/#.*//' | tr '\n' ' ' | sed 's/ //g'` to remove comments
# Character map (according to frequency):
# + > < [ ] - .
# 1 2 3 4 5 6 7
# 43 62 60 91 93 45 46
# start
>>>
# data

Keybase proof

I hereby claim:

  • I am blahgeek on github.
  • I am blahgeek (https://keybase.io/blahgeek) on keybase.
  • I have a public key whose fingerprint is A74A F69A 8CC3 B7F2 28FA 3074 6D7E C222 C6DE 82BF

To claim this, I am signing this object:

@blahgeek
blahgeek / gist:774599fc810dea3bf6ac
Created March 10, 2016 02:12
Stop Safari hanging when selecting the address bar or opening a new tab
This shit has been bugging me for too long, so I went on a hunt and found a workaround.
The Symptoms are as follows:
* Clicking the address bar results in a 1-4 second delay
* Opening links in new tabs results in a 1-4 second delay
* +T results in a 1-4 second delay
* `PressAndHold[<pid>]: IMKServer Stall detected` is present in `/var/log/system.log` at the time of the hang.
It appears to be to do with the PressAndHold helper - the thing that shows an IOS style selection of accents when you hold a key down.
The fix may have some unwanted effects, I haven't really noticed any.
@blahgeek
blahgeek / himawari.py
Last active July 17, 2016 13:29 — forked from willwhitney/himawari.py
Fetch and untile tiled Himawari-8 images from the http://himawari8.nict.go.jp PNG endpoint, then set them as desktop background on OSX
import os
import requests
from datetime import datetime, timedelta
from PIL import Image
from io import BytesIO
import logging
import argparse
TILE_SIZE = 550