Skip to content

Instantly share code, notes, and snippets.

Avatar

Jari Pennanen Ciantic

  • Finland, Jyväskylä
View GitHub Profile
View z-layout.bat
rem Run this file as admin on startup using Task Scheduler
imdisk -a -o awe -s 1024M -m Z: -p "/fs:ntfs /q /y"
mkdir "z:\chrome\"
mkdir "z:\chrome\Application Cache\"
mkdir "z:\chrome\blob_storage"
mkdir "z:\chrome\Cache"
mkdir "z:\chrome\GPUCache"
mkdir "z:\chrome\Session Storage"
View doctest-fails.hs
newtype Maybe' a = Maybe' {getMaybe' :: Maybe a}
deriving Show
-- $setup
-- >>> :set -XScopedTypeVariables
-- >>> :set -XFlexibleContexts
-- >>> import Test.QuickCheck
-- $
-- | Maybe
@Ciantic
Ciantic / job-service-home-wifi.kt
Last active Jul 13, 2019
Listen for a home wifi (Android Q)
View job-service-home-wifi.kt
// Android Q specific way to listen for home wifi
fun jobListenWifiHome(ctx: Context) {
val jobScheduler = getSystemService(ctx, JobScheduler::class.java) ?: return
if (jobScheduler.getPendingJob(6) != null) {
return
}
var netspec = WifiNetworkSpecifier.Builder() // This requires Android Q
.setSsid("your home wifi SSID")
.build()
var req = NetworkRequest.Builder()
@Ciantic
Ciantic / svg-grid.php
Created May 29, 2019
Just some grid ball animation thing I threw away
View svg-grid.php
<?php
$w = 20;
$h = 3;
$spacing = 7;
$padding = 2;
?>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="<?php echo -$padding; ?> <?php echo -$padding; ?> <?php echo $w * $spacing + $padding * 2; ?> <?php echo $h * $spacing + $padding * 2; ?>"
version="1.1">
@Ciantic
Ciantic / sqlite.rowvalues.tests.ts
Created May 9, 2019
SQLite Row values does not seem to work, my test case
View sqlite.rowvalues.tests.ts
import sqlite3 from "sqlite3";
let db: any;
beforeEach(done => {
db = new sqlite3.Database(":memory:", () => {
db.run("CREATE TABLE foo (a INT, b INT)", done);
});
});
@Ciantic
Ciantic / sqlite-uses-gettime.test.ts
Created Apr 24, 2019
node sqlite3 uses getTime (unixepoch as milliseconds) for default date to integer conversion
View sqlite-uses-gettime.test.ts
import sqlite3 from "sqlite3";
let db: any;
beforeEach(done => {
db = new sqlite3.Database(":memory:", () => {
db.run("CREATE TABLE foo (num INT)", done);
});
});
@Ciantic
Ciantic / example-typeorm-jest.test.ts
Created Apr 16, 2019
Example of testing TypeOrm with Jest and Sqlite in-memory database
View example-typeorm-jest.test.ts
import { createConnection, getConnection, Entity, getRepository } from "typeorm";
import { PrimaryGeneratedColumn, Column } from "typeorm";
@Entity()
export class MyEntity {
@PrimaryGeneratedColumn()
id?: number;
@Column()
name?: string;
@Ciantic
Ciantic / cloudflare-dyndns-a-aaaa-record-update.sh
Last active Feb 7, 2022
cloudflare dyndns script / update a A and AAAA record using bash script
View cloudflare-dyndns-a-aaaa-record-update.sh
#!/bin/bash
# Author: Jari Pennanen
# Url: https://gist.github.com/Ciantic/4e543f2d878a87a38c25032d5c727bf2
AUTH_EMAIL="john.doe@example.com" # Your Cloudflare email
AUTH_KEY="" # Get this from My profile -> API Keys -> View
DOMAIN="example.com" # main domain
SUBDOMAIN="home.example.com" # set A and AAAA-record of this subdomain
@Ciantic
Ciantic / wp_mail_disable.php
Last active Mar 4, 2020
Disable wp_mail, and save to file only
View wp_mail_disable.php
<?php
/**
* WP Mail for the development site, should not be used on production site
*
* Throw this in to your *wp_config.php*
*/
function wp_mail($to, $subject, $message, $headers = '', $attachments = array() ) {
$emails_dir = __DIR__ . "/.emails/";
if (!file_exists($emails_dir)) {
mkdir($emails_dir);
View keybase.md

Keybase proof

I hereby claim:

  • I am ciantic on github.
  • I am ciantic (https://keybase.io/ciantic) on keybase.
  • I have a public key whose fingerprint is 2553 436D 15D9 818A 85F1 0B0D A684 B8D5 C267 FAF1

To claim this, I am signing this object: