Skip to content

Instantly share code, notes, and snippets.

@knockshore
knockshore / Table.java
Created February 22, 2021 12:45
Tabular printing using Java
import java.util.Arrays;
/**
*
* @author karti
*/
public class Table {
public static int tableWidth = 100;
public static void printColumns(String[] cols, int[] lengths) {
int ctr = 0;
@knockshore
knockshore / configure_cuda_p70.md
Created October 5, 2021 12:47 — forked from alexlee-gk/configure_cuda_p70.md
Use integrated graphics for display and NVIDIA GPU for CUDA on Ubuntu 14.04

This was tested on a ThinkPad P70 laptop with an Intel integrated graphics and an NVIDIA GPU:

lspci | egrep 'VGA|3D'
00:02.0 VGA compatible controller: Intel Corporation Device 191b (rev 06)
01:00.0 VGA compatible controller: NVIDIA Corporation GM204GLM [Quadro M3000M] (rev a1)

A reason to use the integrated graphics for display is if installing the NVIDIA drivers causes the display to stop working properly. In my case, Ubuntu would get stuck in a login loop after installing the NVIDIA drivers. This happened regardless if I installed the drivers from the "Additional Drivers" tab in "System Settings" or the ppa:graphics-drivers/ppa in the command-line.

@knockshore
knockshore / DE10-LitePin.tcl
Created May 24, 2022 04:42 — forked from tzechienchu/DE10-LitePin.tcl
DE10-Lite Pin TCL
;# look in my book(s) or www.amos.eguru-il.com
;###########################################################
;# A template script for the assigning the DE10_LITE board #
;# Choosing: device, pins, and making design safer ! #
;# Written by: Amos Zaslavsky (C)copyright - Ver 3.0 #
;###########################################################
puts \n
if {![is_project_open]} {
puts "========================================"
puts " ERROR: Assignments can not be done, "
# Node-WebKit CheatSheet
# Download: https://github.com/rogerwang/node-webkit#downloads
# Old Versions: https://github.com/rogerwang/node-webkit/wiki/Downloads-of-old-versions
# Wiki: https://github.com/rogerwang/node-webkit/wiki
# How: https://github.com/rogerwang/node-webkit/wiki/How-node.js-is-integrated-with-chromium
# 1. Run your application.
# https://github.com/rogerwang/node-webkit/wiki/How-to-run-apps
#!/usr/bin/env python3
# ========================================================================== #
# #
# KVMD-OLED - Small OLED daemon for Pi-KVM. #
# #
# Copyright (C) 2018 Maxim Devaev <[email protected]> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
@knockshore
knockshore / Anet+A6_settings.inst.cfg
Created October 9, 2022 02:50 — forked from maciekish/Anet+A6_settings.inst.cfg
Anet A6 profile for Cura 3.5. Start Cura once, create a custom printer called "Anet A6" without changing any of the settings and close Cura. Save and overwrite both files in "AppData\Roaming\cura\3.1\definition_changes" and start Cura again.
[general]
version = 4
name = Anet A6_settings
definition = custom
[metadata]
setting_version = 5
type = definition_changes
[values]
@knockshore
knockshore / ethclient.js
Last active October 24, 2022 17:57
Ethereum Mining Client
class EthClient {
constructor(host, port, user, password, worker) {
this.host = host
this.port = port
this.user = user
this.password = password
this.worker = worker
this.connected = false;
this.queueHead = 0;

Get/set ID3 meta tags using ffmpeg

A quick guide on how to read/write/modify ID3 metadata tags for audio / media files using ffmpeg.

FFmpeg has a free-form command line option that allows the user to specify key-value-pairs for encoding metadata. Let's take a look.

1. Read ID3 metadata

To list all global metadata tags for a media file, just set an input but no output file.

@knockshore
knockshore / AddSSHKey.md
Last active October 24, 2023 15:51
Add SSH key of your PC to your Github account

Check if you have id_rsa.pub file

  • Check contents of id_rsa.pub cat ~/.ssh/id_rsa.pub You should get something like this: sshrsapic

Create a new SSH key (Linux)

  • Open shell (bash)
  • Create new SSH key, ssh-keygen
@knockshore
knockshore / sticky.html
Created July 25, 2024 10:11
Page Manip - Sticker
<div style="display: block; width 100px; height: 100px; background-color: #f00; position: sticky; left: 10px; right 10px;" >
STICKY CHECKING
</div>