Skip to content

Instantly share code, notes, and snippets.

View ifirmawan's full-sized avatar
🎯
Focusing

Iwan firmawan ifirmawan

🎯
Focusing
View GitHub Profile
@juancsr
juancsr / mac-docker-withot-docker-destop.md
Last active April 17, 2024 15:05
Use docker in mac without docker-
@virbo
virbo / lempp.md
Last active June 21, 2024 17:58
Install Linux Centos 7, Nginx, MySQL, Postgres, PHP 8.0

Update LANG

Edit environtment vi /etc/environment add these lines...

LANG=en_US.utf-8
LC_ALL=en_US.utf-8
╔══════════╦═══════════════════╦══════════════════════════════════════════════════════════════════════════╦════════════════════════╦════════════════════════════════════╦════════════════════════╗
║ Operator ║ Tipe Data Operand ║ Deskripsi ║ Contoh Data ║ Contoh penggunaan Operator ║ Hasil ║
╠══════════╬═══════════════════╬══════════════════════════════════════════════════════════════════════════╬════════════════════════╬════════════════════════════════════╬════════════════════════╣
║ @> ║ jsonb ║ Apakah nilai x ada di data JSON? ║ {"a":1, "b":2}' ║ ::jsonb @> '{"b":2}'::jsonb ║ {"a":1, "b":2}' ║
║ <@ ║ jsonb ║ Apakah nilai data JSON mengandung nilai x ? ║ {"b":2}' ║ ::jsonb <@ '{"a":1, "b":2}'::jsonb ║ {"b":2}' ║
║ ? ║ text ║ Apakah key terat
@saineshmamgain
saineshmamgain / app.js
Created May 5, 2020 04:06
Setting up laravel-websockets on production server using nginx proxy with letsencrypt ssl
window.Echo = new Echo({
broadcaster: 'pusher',
key: process.env.MIX_PUSHER_APP_KEY,
wsHost: window.location.host,
wsPort: 80,
wssPort: 443,
disableStats: true,
enabledTransports: ['ws', 'wss'],
cluster: process.env.MIX_PUSHER_APP_CLUSTER,
});
@Henriquetf
Henriquetf / .eslintrc.json
Last active June 2, 2024 11:45
React Native Typescript ESLint config
{
"env": {
"es6": true
},
"extends": [
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"airbnb",
"plugin:import/errors",
"plugin:import/warnings",
@heiswayi
heiswayi / repo-reset.md
Created February 5, 2017 01:32
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@itzikbenh
itzikbenh / TicketController.php
Last active March 9, 2022 14:43
Laravel server side processing for Datatables.
<?php
use Illuminate\Pagination\Paginator;
//This example is a bit more comlex since I have columns that are foreign keys of the Ticket table.
public function index(Request $request)
{
if($request->ajax()) {
$columns = ['tickets.id', 'client_name', 'location', 'priority_name', 'status_name', 'date'];
$draw = $request->draw;
$start = $request->start; //Start is the offset
$length = $request->length; //How many records to show
@fubel
fubel / radon_transform.py
Created September 4, 2016 09:43
Python implementation of the Radon Transform
""" Radon Transform as described in Birkfellner, Wolfgang. Applied Medical Image Processing: A Basic Course. [p. 344] """
from scipy import misc
import numpy as np
import matplotlib.pyplot as plt
def discrete_radon_transform(image, steps):
R = np.zeros((steps, len(image)), dtype='float64')
for s in range(steps):
rotation = misc.imrotate(image, -s*180/steps).astype('float64')
R[:,s] = sum(rotation)
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active June 5, 2024 21:05
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@bobbyali
bobbyali / NaiveBayesBinary.java
Last active January 27, 2019 13:51
Binary Naive Bayes Classifier in Java
package naive_bayes;
import java.util.*;
public class NaiveBayesBinary {
// lists containing training data
private List<Boolean> training_mumPresent = new ArrayList<Boolean>();
private List<Boolean> training_dadPresent = new ArrayList<Boolean>();
private List<Boolean> training_babyPresent = new ArrayList<Boolean>();
private List<Boolean> training_outcome = new ArrayList<Boolean>();