Skip to content

Instantly share code, notes, and snippets.

@y0umu
y0umu / vcard2csv.py
Last active August 7, 2023 10:33
Convert vcard to csv for importing into other applications
'''
将vcard文件转成先锋音讯录音盒的通讯录导入格式(csv,用gbk编码)
csv文件行首是:
姓名,性别,组名,手机,Email,备注
'''
import csv
import codecs
@y0umu
y0umu / .bashrc
Created December 18, 2022 09:54
My .bashrc on Fedora
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
@y0umu
y0umu / countdown.c
Created April 18, 2020 06:05
Countdown timer in C for those who just want a very low memery footprint
/*
* Countdown timer in C
**/
#include <stdio.h>
#include <Windows.h> // Sleep, MessageBox
void showhelp() {
printf("countdown [[hours:]minutes:]seconds\n");
}
'''
A simple countdown timer
'''
import argparse
import time # sleep
import ctypes # MessageBeep, MessageBoxA
def countdown(hms_string: str):
hms = [ int(x) for x in hms_string.split(":") ]
# print(hms)
@y0umu
y0umu / countdown.sh
Created April 16, 2020 06:37
a bash script of a terminal countdown timer
#!/bin/bash
# bash script to simulate a countdown timer
# Inspired by https://superuser.com/questions/611538/is-there-a-way-to-display-a-countdown-or-stopwatch-timer-in-a-terminal
function showhelp {
echo "countdown [[hour:]min:]sec"
}
function beep {
for j in 1 2 3; do
@y0umu
y0umu / example_run_cmd_withoud_cmd_window.vbs
Created September 19, 2019 06:30
Run cmd without cmd window
' https://superuser.com/questions/198525/how-can-i-execute-a-windows-command-line-in-background
Dim WinScriptHost
Set WinScriptHost = CreateObject("WScript.Shell")
WinScriptHost.Run Chr(34) & "D:\Applications\KDE Connect\bin\kdeconnect-start-wrapper.bat" & Chr(34), 0
Set WinScriptHost = Nothing
@y0umu
y0umu / add_big_numbers.cpp
Created August 11, 2019 09:08
Add unsigned big numbers 无符号大数相加
/******************************************************
* 请编程实现求两个超长非负数之和(限定使用C/C++或Java,不可使用类
* 似 BigDecimal等类库).
*
* 要求
*
* ·不损失精度
* ·首尾均不出现无意义的0
* ·不出现无意义的小数点(比如1.00应该输出1)
* ·不得使用除字符操作外的函数
@y0umu
y0umu / red_green_boxes.py
Created June 30, 2019 03:39
为图像添加红框和绿框。其中绿框中的内容为红框中的放大
'''
为图像添加红框和绿框。其中绿框中的内容为红框中的放大
程序不处理不合法的框(直接报错),所以你应该确保输入的框不会越界
'''
#!/usr/bin/python3
import argparse
import os
import glob
@y0umu
y0umu / caffe-ubuntu1604-cuda80-Makefile.config
Created April 17, 2019 15:50
Makefile.config for caffe1.0 to build on ubuntu16.04, with CUDA 8.0, cuDNN 7.1.4.18 installed. Main pitfalls I met are the include dir of "/usr/include/hdf5/serial" and lib path "/usr/lib/x86_64-linux-gnu/hdf5/serial/"
## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!
# cuDNN acceleration switch (uncomment to build with cuDNN).
USE_CUDNN := 1
# CPU-only switch (uncomment to build without GPU support).
# CPU_ONLY := 1
# uncomment to disable IO dependencies and corresponding data layers
@y0umu
y0umu / min-char-rnn.py
Created December 4, 2018 01:49 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)