Skip to content

Instantly share code, notes, and snippets.

@afq984
afq984 / pacmir
Last active February 27, 2018 01:22
pacmir
#!/bin/bash
curl 'https://www.archlinux.org/mirrorlist/?country=TW&protocol=http&ip_version=4&use_mirror_status=on' | cut -c 2- | tee /etc/pacman.d/mirrorlist
@afq984
afq984 / 0_this_works.py
Created September 14, 2015 12:07
socket problem
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('', 5556))
s.connect(('192.168.1.1', 5556))
s.send(b'first')
s.send(b'second')
@afq984
afq984 / preferences.md
Last active August 13, 2017 09:36
Arch Linux Installation Notes

Configure Network

Wired - nothing to do

Wireless - wifi-menu

Partitioning

/boot - fat32, 200MB ref

@afq984
afq984 / ostreamwrapper.cc
Created November 28, 2015 00:09
Ostream Wrapper
#include <iostream>
class OstreamWrapper {
private:
std::ostream& os;
public:
std::string sep;
std::string end;
@afq984
afq984 / Makefile
Created March 16, 2016 02:59
Makefile example
# %.o: %.cc
# Pattern rule: https://www.gnu.org/software/make/manual/html_node/Pattern-Rules.html
# $@ target name
# $^ all prerequisites
# $< first prerequisite
# Automatic variables: https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html
# .PHONY
# the target is not really a file
@afq984
afq984 / cached-property.ipynb
Created July 29, 2016 00:02
Cached Property
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python3
import argparse
import sys
parser = argparse.ArgumentParser()
parser.add_argument('vertices', type=int)
N = parser.parse_args().vertices
left = 1
#!/usr/bin/env python2
import sys
import re
import subprocess
import itertools
_find_unsafe = re.compile(r'[^\w@%+=:,./-]').search
@afq984
afq984 / classes.py
Created August 12, 2017 13:06
Where can I import my PyQt5 class?
from PyQt5.Enginio import Enginio
from PyQt5.Enginio import EnginioClient
from PyQt5.Enginio import EnginioClientConnection
from PyQt5.Enginio import EnginioIdentity
from PyQt5.Enginio import EnginioModel
from PyQt5.Enginio import EnginioOAuth2Authentication
from PyQt5.Enginio import EnginioReply
from PyQt5.QtCore import QAbstractAnimation
from PyQt5.QtWidgets import QAbstractButton
from PyQt5.QtCore import QAbstractEventDispatcher
@afq984
afq984 / gist:f2b5ab210eecffb71065bd1e2295e335
Created September 30, 2017 05:16
yay -S --noconfirm numix-circle-icon-theme-git
[afg@vbox ~]$ ~/go/bin/yay -S --noconfirm numix-circle-icon-theme-git
==> Installing numix-circle-icon-theme-git
=> Run Dependencies:
==> AUR dependencies: numix-icon-theme-git
==> Installing numix-icon-theme-git
=> Run Dependencies:
==> Repository dependencies: gtk-update-icon-cache
resolving dependencies...
looking for conflicting packages...