Skip to content

Instantly share code, notes, and snippets.

View httpsterio's full-sized avatar
delete this pls

Sami httpsterio

delete this pls
View GitHub Profile
@httpsterio
httpsterio / app.js
Created May 4, 2017 11:18
template-literal-test.js
let deadline = "05/05/2017 10:45";
function getTimeRemaining(endtime) {
var t = Date.parse(endtime) - Date.parse(new Date());
var seconds = Math.floor(t / 1000 % 60);
var minutes = Math.floor(t / 1000 / 60 % 60);
var hours = Math.floor(t / (1000 * 60 * 60) % 24);
var days = Math.floor(t / (1000 * 60 * 60 * 24));
return {
total: t,
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'stable',
@httpsterio
httpsterio / copypath_copycontent.sh
Last active April 26, 2018 09:55
A few handy bash commands I created for my own needs.
cpath () {
pwd > ~/.pathfile
echo 'path copied'
}
ppath () {
cd $(cat ~/.pathfile)
}
cfile () {
/// <summary>
///
/// </summary>
double r = 10;
public override void Begin()
{
Camera.ZoomToLevel();
Level.Background.Color = Color.Black;
Lumipallo(0,0);
Lumipallo(-50, 200);
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class t3_4_miidi
{
public static void Main()
{
//double[] luvut = {-1, -2, -3, 2, 5, -10}; // keskiarvo == 0.2
@httpsterio
httpsterio / lahinpallo.cs
Created February 27, 2020 20:31
LahinPallo
using System;
using System.Collections.Generic;
using Jypeli;
using Jypeli.Assets;
using Jypeli.Controls;
using Jypeli.Widgets;
public class T4_5_LahinPallo : PhysicsGame
{
public override void Begin()
using System;
using System.Collections.Generic;
using Jypeli;
using Jypeli.Assets;
using Jypeli.Controls;
using Jypeli.Widgets;
public class T6_hiiripallo : PhysicsGame
{
public override void Begin()
const articleImages = [...document.querySelectorAll("main article img")];
if (articleImages.length) {
articleImages.forEach((image) => {
// If an image has a title it means that the user added a caption
// so replace the image with a figure containing that image and a caption
if (image.hasAttribute("title")) {
const figure = document.createElement("figure");
const figCaption = document.createElement("figcaption");
figCaption.innerHTML = image.getAttribute("title");
#!/bin/bash
#
# This is a script to update a Netlify subdomain A record with the current external IP.
# The example below would update the local.example.com A record to the current external IP with a TTL of 5 minutes.
# Copied from https://blog.skylerlewis.io/2020/12/diy-dynamic-dns-using-netlify-api.html
#
# Usage:
# netlify-ddns.sh <ACCESS_TOKEN> <DOMAIN> <SUBDOMAIN> <TTL>
#
# Example:
#!/bin/bash
#
# Asettaa Netlifyssa A-recordin koneen nykyisellä ulkoisella ip:llä. Dependency ainoastaan jq.
# Tarvitsee argumentteina access tokenin (https://app.netlify.com/applications), verkko-osoitteen, aliosoitteen ja vanhenemisajan minuutteina.
# esim: ./netlify-dynamicdns.sh $AccessToken $Domain $Subdomain $TTL
#
if [ "$#" -ne 4 ]; then
echo "Wrong number of parameters passed"
echo "Usage:"
echo "$0 <ACCESS_TOKEN> <DOMAIN> <SUBDOMAIN> <TTL>"