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
// -*- mode: java; -*- | |
// Source code for the YouTube video: https://youtu.be/c4umDcNHBVs | |
// Start jshell in a GNU/Linux OS as follows (same instructions as | |
// the video) | |
/* | |
* jshell --startup SelfModify.jsh | |
*/ | |
// After starting jshell, |
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
# Made for the YouTube video https://youtu.be/TFIxU_vOCR8 | |
from itertools import count | |
import hashlib | |
import zlib | |
PREFIX = b'commit %d\x00' | |
COMMIT_TEMPLATE = b'tree 62ee7f49375b274e064e4277b10f044fca62f144\nparent e4fe1d2e9d8e123586da04c86cf74983ae399385\nauthor Vijay Lakshminarayanan <laksvij@hawk.iit.edu> 1597940579 +0530\ncommitter Vijay Lakshminarayanan <laksvij@hawk.iit.edu> 1597940579 +0530\n\ncommit #%d contains c0ffee\n' | |
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
function csv2sqlitedb() { | |
_FILENAME=$1 | |
_TABLENAME=$2 | |
echo " | |
.mode csv | |
.import \"${_FILENAME}\" ${_TABLENAME} | |
.save ${_TABLENAME}.db" | sqlite3 | |
} | |
## Sample usage |
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
## Generate a video from a sequence of images | |
ffmpeg -framerate 2 -pattern_type glob -i '*.PNG' -c:v libx264 -pix_fmt yuv420p out.mp4 | |
# framerate -- each frame will show on screen for 1/framerate seconds (in this case 1/2 = 0.5s) |
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
guilty :- true. | |
innocent :- false. | |
solve_inspector(Chase, Decker, Ellis, Heath, Mullaney):- | |
% each individual is either innocent or guilty | |
member(Chase, [guilty, innocent]), | |
member(Decker, [guilty, innocent]), | |
member(Ellis, [guilty, innocent]), | |
member(Heath, [guilty, innocent]), | |
member(Mullaney, [guilty, innocent]), |
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
% The below program solves a Logic Grid Puzzle using Prolog. | |
% The puzzle is available at the following url: | |
% https://www.brainzilla.com/logic/logic-grid/trick-or-treat/ | |
% License: Public Domain | |
/* | |
* Tested with SWI-Prolog. | |
* To run: | |
* |
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
public class Dispatch { | |
static class Fruit { public String taste = "---"; } | |
static class Melon extends Fruit { public String taste = "squishy"; } | |
static class Watermelon extends Melon { public String taste = "sweet"; } | |
public void describe(Object o) { print("object", "inedible."); } | |
public void describe(Fruit f) { print("fruit", f.taste); } | |
public void describe(Melon m) { print("melon", m.taste); } | |
public void describe(Watermelon w) { print("watermelon", w.taste); } | |
public static void main(String[] args) { |
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
## documentation pending | |
## tldr, there are 3 barrels on the floor, touching one another | |
## there's a board on the barrels that's at 60° from the horizontal | |
## the board touches all the barrels | |
## the first barrel has diameter 10 | |
## what's the diameter of the 3rd barrel? | |
## this program draws the problem and solves it | |
## to run: | |
## python3 2021-05-07.py |
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
def din(n): | |
if n: | |
rest() | |
else: | |
less() | |
## reset | |
def rest(): | |
print("tridnt") |
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
import static java.nio.charset.StandardCharsets.US_ASCII; | |
import static java.nio.file.Files.newBufferedReader; | |
import static java.nio.file.Files.newByteChannel; | |
import static java.nio.file.StandardOpenOption.READ; | |
import static java.nio.file.StandardOpenOption.WRITE; | |
import java.io.IOException; | |
import java.nio.ByteBuffer; | |
import java.nio.CharBuffer; | |
import java.nio.charset.Charset; |
NewerOlder