Skip to content

Instantly share code, notes, and snippets.

@juanonsoftware
juanonsoftware / pdf-text-extraction.cs
Last active May 8, 2024 16:11
C# How to get text from PDF file with iTextSharp
// source is a byte array
using (var reader = new PdfReader(source))
{
using (var output = new StringWriter())
{
for (int i = 1; i <= reader.NumberOfPages; i++)
{
output.WriteLine(PdfTextExtractor.GetTextFromPage(reader, i));
}
@kll
kll / TypeMemberLayout.xaml
Last active May 8, 2024 16:11
ReSharper/Rider StyleCop file layout
<?xml version="1.0" encoding="utf-16"?>
<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
<TypePattern DisplayName="Non-reorderable types">
<TypePattern.Match>
<Or>
<And>
<Kind Is="Interface" />
<Or>
<HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" />
<HasAttribute Name="System.Runtime.InteropServices.ComImport" />
@Paraphraser
Paraphraser / Compiling GoSungrow.md
Last active May 8, 2024 16:08
Compiling GoSungrow

Updating GoSungrow

This gist is intended to help you deal with the following error messages:

  • Error: appkey is incorrect 'er_invalid_appkey
  • Error: unknown error 'Request is not encrypted'

This gist has four parts. The instructions you should follow depend on what you want to do:

| Part | Explains how to |

@Hadaward
Hadaward / mutex-concept.ts
Last active May 8, 2024 16:08
A mutex concept implemented in javascript, to ensure you don't have unexpected value changes.
export type MutexGuard<T> = Readonly<{
id: string,
get: () => T,
set: (value: T) => void,
unlock: () => void
}>;
export type Mutex<T> = Readonly<{
lock(): Promise<MutexGuard<T>>
}>;
@FFY00
FFY00 / tracker-list.txt
Last active May 8, 2024 16:06
Torrent Trackers
http://104.28.1.30:8080/announce
http://104.28.16.69/announce
http://107.150.14.110:6969/announce
http://109.121.134.121:1337/announce
http://114.55.113.60:6969/announce
@ziyan0302
ziyan0302 / cuda11.3_installation_on_Ubuntu_20.04
Last active May 8, 2024 16:06
cuda11.3, cudnn11.3, Tensorflow2.8.0, Pytorch1.10.2, ubuntu20.04.txt
#!/bin/bash
## check nvidia driver version
nvidia-smi
# 510
## to uninstall cuda
# sudo apt-get --purge remove "*cublas*" "cuda*" "nsight*"
# sudo apt-get --purge remove "*nvidia*"
# or
@BrennanBarker
BrennanBarker / shovelpass.py
Created November 19, 2020 19:38
look for an environment variable before using get pass
"""First check environment variables for a password, if not then use `getpass`.
You might set the environment variable ahead of time with (from a shell)::
read -s secret
export secret
"""
import os, getpass
@tanyuan
tanyuan / smart-caps-lock.md
Last active May 8, 2024 16:05
Smart Caps Lock: Remap Caps Lock to Control AND Escape

Smart Caps Lock: Remap to Control AND Escape (Linux, Mac, Windows)

Caps Lock 變成智慧的 Control 以及 Escape

  • 單獨輕按一下就是 Escape
  • 若按下時同時按著其他鍵,就會是 Control

這應該是 Vim 和 Emacs 的最佳解了!(Emacs? Bash 的快捷鍵就是 Emacs 系列的)

  • Send Escape if you tap Caps Lock alone.
@jonjack
jonjack / add-update-refresh-github-access-token-on-mac.md
Last active May 8, 2024 16:05
Adding & Updating GitHub Access Token on Mac

Using an Access Token for the first time

Follow the instructions on Github to Create an Access Token in Github

Configure Git to use the osxkeychain

By default, git credentials are not cached so you need to tell Git if you want to avoid having to provide them each time Github requires you to authenticate. On Mac, Git comes with an “osxkeychain” mode, which caches credentials in the secure keychain that’s attached to your system account.

You can tell Git you want to store credentials in the osxkeychain by running the following:-

@ruzickap
ruzickap / openwrt_transmission.sh
Last active May 8, 2024 16:04
OpenWrt Transmission
opkg install transmission-remote transmission-web
mkdir -p /data/torrents/torrents-completed /data/torrents/torrents-incomplete /data/torrents/torrents /data/torrents/config
uci set transmission.@transmission[-1].enabled=1
uci set transmission.@transmission[-1].config_dir=/data/torrents/config
uci set transmission.@transmission[-1].download_dir=/data/torrents/torrents-completed
uci set transmission.@transmission[-1].incomplete_dir_enabled=true
uci set transmission.@transmission[-1].incomplete_dir=/data/torrents/torrents-incomplete
uci set transmission.@transmission[-1].blocklist_enabled=1