This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Happens when you didn't update to latest ubuntu when you should have. | |
# For shame. Here's how to fix. | |
# Credit to: https:digitalocean.com/community/questions/unable-to-apt-update-my-ubuntu-19-04 | |
cp /etc/apt/sources.list ~/sources.list.bak | |
sudo sed -i -re 's/([a-z]{2}\.)?archive.ubuntu.com|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list | |
sudo apt-get update && sudo apt-get dist-upgrade |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Transform list into flashcards with chars on front and pinyin/defn on back. | |
list_to_flashcards () { | |
LEVEL=$1 | |
URL="https://raw.githubusercontent.com/glxxyz/hskhsk.com/main/data/lists/HSK%20Official%20With%20Definitions%202012%20L${LEVEL}%20freqorder.txt" | |
OUTFILE="HSK${LEVEL}.tsv" | |
curl -s $URL \ | |
| sed 's/\r$//' \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
co = checkout | |
ci = commit | |
st = status -s | |
br = branch | |
ls = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue) <%an>%Creset' --abbrev-commit --decorate | |
ll = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue) <%an>%Creset' --abbrev-commit --decorate --numstat | |
type = cat-file -t | |
dump = cat-file -p | |
undo = reset --soft HEAD~1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <dirent.h> | |
int main(int argc, char** argv) | |
{ | |
if(argc != 2) | |
{ | |
printf("usage: %s <pid>", argv[0]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main(int argc, char** argv) | |
{ | |
const int size = 256; | |
char ip_address[size]; | |
int hw_type; | |
int flags; |