Skip to content

Instantly share code, notes, and snippets.

View SolveSoul's full-sized avatar
🦑

Axel SolveSoul

🦑
View GitHub Profile
@flandrade
flandrade / automatically-add-icalendar-events.md
Last active April 20, 2024 16:18
Automatically Add iCalendar Events (.ics) to Calendars

Automatically Add iCalendar Events (.ics) to Calendars

Do you want to create a calendar event so that you can display it on an iPhone's calendar app or in Google Calendar? This can be done by using iCalendar events RFC 5545 as part of the following workflow:

  1. The user signs up for an event online.
  2. The user receives the iCalendar file as an attachment in the email.
  3. The .ics file contains information for the event at a specific time and date.
@nicksheffield
nicksheffield / timeslots-generator.js
Created February 17, 2020 02:49
Generate an array of time slots from a beginning to an end, skipping forward a certain amount of time each time
import { isBefore, setHours, setMinutes, setSeconds, addMinutes, setMilliseconds } from 'date-fns'
const setTime = (x, h = 0, m = 0, s = 0, ms = 0) => setHours(setMinutes(setSeconds(setMilliseconds(x, ms), s), m), h)
const from = setTime(new Date(), 9)
const to = setTime(new Date(), 17)
const step = (x) => addMinutes(x, 30)
const blocks = []
let cursor = from
@fliphess
fliphess / wol.py
Created December 21, 2017 15:01
Wake up post 2016 Philips TV's using Wake on Lan
#!/usr/bin/env python3
import struct
import re
import socket
import sys
MAC = '1c:5a:6b:b8:93:c0'
def wake_on_lan(mac):
@melcma
melcma / LumenNginxUbuntu
Last active November 18, 2023 16:22
Lumen + Nginx + Ubuntu
cd ~
sudo apt-get update
1. Install PHP and Nginx
#apt-get install software-properties-common
sudo apt-get -y install nginx php7.0 php7.0-fpm php7.0-mbstring php7.0-xml git composer
2. Config Nginx
@davidofwatkins
davidofwatkins / google-fonts-sync-git.md
Last active November 23, 2023 14:47
Keep MacOS Fonts Updated with Google Fonts

Google Fonts suggests syncing fonts to your computer with a tool called SkyFonts. However, if you're running MacOS and want to keep your machine updated with all Google Fonts without any extra software, you can do this with Git, thanks to the Google Fonts Repo.

To do this, run the following in your terminal:

cd ~/Library/Fonts/
git clone --depth 1 https://github.com/google/fonts.git google-fonts

Done! In the future, you can download new fonts by running:

@antonkomarev
antonkomarev / gist:907667d2aa3c972b6b7d290664290ac6
Created August 22, 2016 20:14
Call Laravel artisan without memory limit
php -d memory_limit=8000M artisan migrate:refresh --seed
@tangxinfa
tangxinfa / delete_after_download.js
Last active February 13, 2023 03:56
how to delete file after download in node.js
var fs = require('fs'),
express = require('express'),
app = express();
function deleteFile (file) {
fs.unlink(file, function (err) {
if (err) {
console.error(err.toString());
} else {
console.warn(file + ' deleted');
@TWiStErRob
TWiStErRob / OkHttpProgressGlideModule.java
Last active January 31, 2024 13:37
Full POC for showing progress of loading in Glide v3 via OkHttp v2
// TODO add <meta-data android:value="GlideModule" android:name="....OkHttpProgressGlideModule" />
// TODO add <meta-data android:value="GlideModule" tools:node="remove" android:name="com.bumptech.glide.integration.okhttp.OkHttpGlideModule" />
// or not use 'okhttp@aar' in Gradle depdendencies
public class OkHttpProgressGlideModule implements GlideModule {
@Override public void applyOptions(Context context, GlideBuilder builder) { }
@Override public void registerComponents(Context context, Glide glide) {
OkHttpClient client = new OkHttpClient();
client.networkInterceptors().add(createInterceptor(new DispatchingProgressListener()));
glide.register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client));
}
@davestevens
davestevens / download-images-from-google-drive.js
Last active March 15, 2023 16:20
Download images from Google Drive folder using Node.js Google library
var google = require("googleapis"),
drive = google.drive("v2"),
fs = require("fs");
var config = {
"client_id": "client_id",
"client_secret": "client_secret",
"scope": "scope",
"redirect_url": "redirect_rul",
"tokens": {
@alex-shpak
alex-shpak / Interceptor.java
Last active March 29, 2023 21:06
Refreshing OAuth token with okhttp interceptors. All requests will wait until token refresh finished, and then will continue with the new token.
private class HttpInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
//Build new request
Request.Builder builder = request.newBuilder();
builder.header("Accept", "application/json"); //if necessary, say to consume JSON