Skip to content

Instantly share code, notes, and snippets.

View musoftware's full-sized avatar
🌏
Working from home

Musoftware musoftware

🌏
Working from home
View GitHub Profile
@musoftware
musoftware / my.cnf
Created March 4, 2023 17:57
mysql configuration
# * Fine Tuning
key_buffer = 64M
max_allowed_packet = 128M
thread_cache_size = 30
myisam-recover = BACKUP
max_connections = 150
table_open_cache = 2048
thread_concurrency = 10
wait_timeout = 600
@musoftware
musoftware / avoidhang.cs
Created October 25, 2022 11:23
New Avoid Hang
internal class AvoidHang : IDisposable
{
private readonly SemaphoreSlim _semaphore = new System.Threading.SemaphoreSlim(1, 1);
Stopwatch stopwatch = new Stopwatch();
bool _started = true;
public AvoidHang(int fast = 1000)
{
stopwatch.Start();
(new Thread(() =>
@musoftware
musoftware / thread_semaphore.cs
Created October 7, 2022 22:12
Sequence Thread Starting and wait
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApp1
{
internal class Program
@musoftware
musoftware / status.php
Created September 20, 2022 16:08
woo-commerce Status
Array
(
[wc-pending] => Pending payment
[wc-processing] => Processing
[wc-on-hold] => On hold
[wc-completed] => Completed
[wc-cancelled] => Cancelled
[wc-refunded] => Refunded
[wc-failed] => Failed
[wc-checkout-draft] => Draft
@musoftware
musoftware / countries.blade.php
Created June 30, 2022 12:20
Laravel Country List
<select id="country" name="country" class="form-control {{ $errors->has('country') ? 'is-invalid' : '' }}" class="form-control">
<option value="Afghanistan" {{ old('country' == "Afghanistan") ? 'selected' : '' }}>Afghanistan</option>
<option value="Åland Islands" {{ old('country' == "Åland Islands") ? 'selected' : '' }}>Åland Islands</option>
<option value="Albania" {{ old('country' == "Albania") ? 'selected' : '' }}>Albania</option>
<option value="Algeria" {{ old('country' == "Algeria") ? 'selected' : '' }}>Algeria</option>
<option value="American Samoa" {{ old('country' == "American Samoa") ? 'selected' : '' }}>American Samoa</option>
<option value="Andorra" {{ old('country' == "Andorra") ? 'selected' : '' }}>Andorra</option>
<option value="Angola" {{ old('country' == "Angola") ? 'selected' : '' }}>Angola</option>
<option value="Anguilla" {{ old('country' == "Anguilla") ? 'selected' : '' }}>Anguilla</option>
<option value="Antarctica" {{ old('country' == "Antarctica") ? 'selected' : '' }}>Antarctica</option
@musoftware
musoftware / flutter.dart
Created March 13, 2022 22:14
Simple Provider Flutter Example
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
void main() {
runApp(
ChangeNotifierProvider(
create: (_) => Person(name: "Yohan", age: 25),
child: MyApp(),
),
);
@musoftware
musoftware / file.java
Created November 19, 2021 21:56
Social Android Studio
public static Intent getOpenFacebookIntent(Context context) {
try {
context.getPackageManager().getPackageInfo("com.facebook.katana", 0);
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("fb://page/xxx"));
intent.addFlags(CrashUtils.ErrorDialogData.BINDER_CRASH);
return intent;
} catch (Exception unused) {
return new Intent("android.intent.action.VIEW", Uri.parse("https://www.facebook.com/xxx/"));
}
@musoftware
musoftware / dict.cs
Last active August 24, 2021 12:05
make Dict
using System;
using System.Collections.Generic;
namespace test
{
class Program
{
static void Main(string[] args)
{
MakeDict(new int[] { 10, 20, 30 }, new string[] { "B1", "B2", "B3" });
@musoftware
musoftware / country.php
Last active September 17, 2021 22:18
Php Array Country - Code
<?php
$countries = array(
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
'AO' => 'Angola',
'AI' => 'Anguilla',
@musoftware
musoftware / unfriends.js
Last active November 10, 2020 13:08
unfriends
setInterval(function(){
let outTime = 1;
for(let Xo of document.querySelectorAll('*[data-sigil="touchable are-friends-popup"]'))
{
setTimeout(function(){
Xo.click();
setTimeout(function(){
Xo.click();
document.querySelector('*[data-sigil="touchable touchable mflyout-remove-on-click m-unfriend-request"]').click();